【发布时间】:2021-07-27 12:45:49
【问题描述】:
@commands.command(aliases=['hban'])
@commands.has_permissions(ban_members=True)
@commands.cooldown(1,3,BucketType.user)
async def hackban(self, ctx, userID:int):
if userID in guild.members:
embed = discord.Embed(description=":oxmark: "+f"Unsuccessful, the user is in this guild. [-help ban]", color=discord.Color.orange())
await ctx.reply(embed=embed, mention_author=False)
else:
await ctx.guild.ban(discord.Object(id=userID))
embed = discord.Embed(title=":ocheckmark: "+f"Successfully hack banned {userID}", color=discord.Color.orange())
await ctx.reply(embed=embed, mention_author=False)
我正在制定一个 hackban 命令,该命令通过他们的 ID 禁止不在公会中的用户。到目前为止,这是我的代码,它没有响应或给出任何错误。
【问题讨论】:
-
这能回答你的问题吗? stackoverflow.com/questions/67330522/…
-
@Dominik,我重写了命令,我现在要做的是,如果用户在公会中,它不会禁止他们,但它不起作用
标签: discord discord.py