【问题标题】:Discord.py AFK Command RewriteDiscord.py AFK 命令重写
【发布时间】:2021-07-15 05:39:49
【问题描述】:

这是我的 afk 命令:

@client.event
async def on_message(message):
    if message.mentions
    results = collection.find({"member": message.author.id}) 
    for result in results:
        collection.delete_one(result)
        if message.content == result:
            await message.channel.send(f"This person is currently AFK. \nFor: {reason}")
        

    await client.process_commands(message)

错误:

  File "main.py", line 124
    if message.mentions
                      ^
SyntaxError: invalid syntax

我有点困惑为什么。有什么想法吗?

【问题讨论】:

    标签: python python-3.x command discord.py client


    【解决方案1】:

    添加条件冒号:,

    @client.event
    async def on_message(message):
        if message.mentions:
            results = collection.find({"member": message.author.id}) 
            for result in results:
                collection.delete_one(result)
                if message.content == result:
                    await message.channel.send(f"This person is currently AFK. \nFor: {reason}")
                
    
            await client.process_commands(message)
    

    【讨论】:

      猜你喜欢
      • 2021-01-22
      • 2020-10-19
      • 2020-05-03
      • 2020-11-06
      • 2021-03-30
      • 2020-09-11
      • 2021-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多