【发布时间】:2021-04-28 14:48:31
【问题描述】:
我想让拥有manage_messages 权限的人可以使用该命令,加上我,机器人的所有者,即使我没有manage_messages 权限也可以使用该命令。这是我到目前为止的代码:
@commands.command()
@commands.has_permissions(manage_messages = True)
async def spam(self, ctx, msg, delay: int):
global on
on = True
while on:
await ctx.send(msg)
await asyncio.sleep(int(delay))
@spam.error
async def spam_error(self, ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f"Missing argument(s). Proper usage: `{prefix}spam <message to spam> <delay in seconds>`")
if isinstance(error, commands.MissingPermissions):
await ctx.send("Missing permission(s): Manage_Messages")
if isinstance(error, commands.BadArgument):
await ctx.send("The delay must be an integer")
【问题讨论】:
标签: python discord discord.py