Answer the question
In order to leave comments, you need to log in
The bot bans for a reason consisting of 1 word, how to fix it?
There is a code to ban a participant by ping or ID:
@bot.command()
@commands.has_guild_permissions(ban_members=True)
async def ban(ctx, member:discord.User=None, reason =None):
if member == ctx.message.author:
await ctx.channel.send("Жаль, но ты не можешь забанить себя :(")
return
if reason == None:
reason = "Причина бана не указана"
message = f"Вы были забанены на сервере **{ctx.guild.name}** по следующей причине: \n{reason}."
await member.send(message)
await ctx.guild.ban(member, reason=reason)
embed = discord.Embed(
title = 'Успешно!',
description = f'{member} забанен по причине {reason} модератором {ctx.author.mention}!',
colour = discord.Colour.from_rgb(0, 255, 0)
)
await ctx.send(embed=embed)
@ban.error
async def cmderr27262682919625141(ctx, error):
if isinstance(error, commands.errors.MissingPermissions):
await ctx.send(':x: У вас недостаточно прав!')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question