当任何客户端创建一个通道时,我都试图构建一个打印消息的机器人。我使用的是discord.py版本1.2.3
import discord
import discord.ext
client = discord.Client()
@client.event
async def channel_create(channel):
if discord.on_guild_channel_create():
await print('the channel has been create ')
return
client.run('TOKEN')当我运行它时,我会得到以下错误:
AttributeError: module 'discord' has no attribute 'on_guild_channel_create'
有解决这个问题的建议吗?
发布于 2019-10-02 22:28:29
基于API参考,我认为您的函数需要覆盖on_guild_channel_create(),而不是调用它作为另一个函数的一部分。
import discord
import discord.ext
client = discord.Client()
@client.event
async def on_guild_channel_create(channel):
await print('the channel has been create ')
return
client.run('TOKEN')https://stackoverflow.com/questions/58210000
复制相似问题