接收和发送消息到特定类别(discord bot)

时间:2020-12-29 20:20:07

标签: python discord

下面也包括我的消息对象 这是我针对特定频道的代码,它有效:

@client.event
async def on_message(message):
    if message.author == client.user:
      return
    
    msg = message.content
    msg = msg.lower()
    if message.channel.name == "name" and msg.startswith('bruh'):
        await message.channel.send('hello')```
#Here is what I tried with specific category:
    if message.category.name == "name" and msg.startswith('bruh'):
        await message.channel.send('hello')`
#Error:AttributeError: 'Message' object has no attribute 'category', I also tried with message.category.id and got the same error
#I want the bot to receive a command in a specific category and return a message in that category and to the channel where it received the command.

0 个答案:

没有答案