How to kick users on command

前端 未结 3 1289
眼角桃花
眼角桃花 2021-01-28 12:25

I don\'t have much knowledge on Python, and still in the process of learning it.

I have been significantly modifying an open-source Discord bot coded in Python 2.7.

3条回答
  •  被撕碎了的回忆
    2021-01-28 13:06

    @commands.has_permissions(kick_members=True)
    @bot.command()
    async def kick(ctx, user: discord.Member, *, reason="No reason provided"):
            await user.kick(reason=reason)
            kick = discord.Embed(title=f":boot: Kicked {user.name}!", description=f"Reason: {reason}\nBy: {ctx.author.mention}")
            await ctx.message.delete()
            await ctx.channel.send(embed=kick)
            await user.send(embed=kick)
    

提交回复
热议问题