在bash中获取FORBIDDEN Missing Permissions错误。 如果在某个频道中阻止机器人,则该阻塞频道中的某个类型命令会在bash中获得FORBIDDEN Missing Permissions错误。
$ ./bin/str_printf_null
before null %c after null
using 0 : 'before null '
using \0: 'before null '
我在下面添加了on_command_error,代码仍然是我收到错误。所以我们需要为discord.errors.Forbidden添加另一行:FORBIDDEN
实际上我的问题是当有人在其他频道输入错误命令时会收到Ignoring exception in on_command_error
Traceback (most recent call last):
File "/home/demotry/.local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "bot.py", line 59, in on_command_error
await bot.send_message(ctx.message.channel, "**wrong command.** " + ctx.message.author.mention)
File "/home/demotry/.local/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/home/demotry/.local/lib/python3.6/site-packages/discord/http.py", line 196, in request
raise Forbidden(r, data)
discord.errors.Forbidden: FORBIDDEN (status code: 403): Missing Permissions
消息,但如果他们在频道中键入错误命令,则僵尸被阻止发送消息我在bash中收到错误。
wrong command.