【问题标题】:Nuke command discord.pyNuke 命令 discord.py
【发布时间】:2021-03-30 08:24:52
【问题描述】:

好的,这段代码有问题,但我不明白是什么。

@client.command(aliases=['killchat'])
async def nuke(ctx, amount=9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, channeltwo : ctx.message.channel = None):
   if channeltwo == None:
       await ctx.channel.purge(limit=amount)
   else:
       await ctx.channeltwo.purge(limit=amount)

请帮帮我,我不明白为什么模块'ctx'没有属性'message'!(这是错误)

【问题讨论】:

    标签: discord discord.py-rewrite python-3.8


    【解决方案1】:

    尝试ctx.message.author.channel,API 允许机器人清除的内容存在限制。您将无法清除该数量。此外,如果消息早于 2 周或更长时间,您也将无法清除它们。

    【讨论】:

    • 我的客户可以在没有以下代码的情况下清除该数量。问题出在channeltwo : ctx.message.channel = None
    • 我的意思是:使用ctx.message.author.channel 而不是ctx.message.channel
    • 编码,ctx没有属性消息!
    • 你用过ctx.message.author.channel吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-27
    • 2021-03-29
    • 2021-03-26
    • 2021-08-28
    • 2021-01-22
    • 2021-05-17
    • 2021-01-15
    相关资源
    最近更新 更多