【发布时间】:2020-09-23 17:01:31
【问题描述】:
我有一个运行 discord.py 的 Discord 机器人,当我使用帮助功能时,消息之间有时会有几秒钟的小延迟。当一个活生生的用户在 Discord 上打字时,它通常会显示 3 个交替阴影的小点,同时说 Example 正在打字。我怎样才能用我的机器人显示这个? 我有一个现在不起作用的功能,即 和
async def balabala (ctx):
async with ctx.typing():
await message.channel.send(prefix + "random [Value 1] [Value 2] - Gives a random number between Value 1 and Value 2, inclusive")
await ctx.send(prefix + "choose [Value 1] (Value 2) (Value 3) etc. - Chooses a random value from the list of values you provide") # what you want to do after typing
@client.event
async def on_message(message):
if message.content.lower() == prefix + "help":
await message.channel.send("The prefix for this bot is " + prefix)
await message.channel.send("Note: Do not actually enter [](required) or ()(Not required)")
await message.channel.send(prefix + "help - Shows this message" )
await message.channel.send("Hello - Gives a hello back, because you are so nice")
await message.channel.send(prefix + "invite - Gives an invite to the bot, and Canary versions")
await balabala()
出现的错误是
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "discordbotcanary.py", line 45, in on_message
await balabala()
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 354, in __call__
return await self.callback(*args, **kwargs)
TypeError: balabala() missing 1 required positional argument: 'ctx'
【问题讨论】:
标签: python discord discord.py