from discord.ext import commands
client = commands.Bot( command_prefix = '.' )
client.remove_command( 'help' )
# hello
@client.event
async def on_ready ( ctx ):
print( 'Я включился' )
@client.event
async def on_command_error( ctx, error ):
pass
@client.command( pass_context = True )
async def привет( ctx, arg ):
author = ctx.message.author
await ctx.send( f' { author.mention }, ' + arg )
# Clear Message
@client.command( pass_context = True )
@commands.has_any_role( 862924214565339148, 862696882290425886, 870234589967306753, 863300008726888488, 870234350187347978, 870235166688280597, 869042559660478494, 861977273413402684 )
async def очистка( ctx, amount : int ):
author = ctx.message.author
await ctx.channel.purge( limit = amount )
await ctx.send( f'**{ author.mention }**, очистил сообщения' )
#help
@client.command( pass_context = True )
async def помощь( ctx ):
emb = discord.Embed( title = 'Помощь по командам ' )
emb.add_field( name = '{}помощь'.format( PREFIX ), value = 'Очищает чат' )
emb.add_field( name = '{}бан'.format( PREFIX ), value = 'Блокирует участника навсегда' )
emb.add_field( name = '{}разбан'.format( PREFIX ), value = 'Разблокирует заблокированного участника' )
emb.add_field( name = '{}кик'.format( PREFIX ), value = 'Выгоняет участника с сервера' )
emb.add_field( name = '{}мут'.format( PREFIX ), value = 'Запрещает говорить участнику навсегда' )
await ctx.send( embed = emb )
#Ban
@client.command( pass_context = True )
@commands.has_any_role( 862924214565339148, 862696882290425886, 870234589967306753, 863300008726888488, 870234350187347978, 870235166688280597, 869042559660478494, 861977273413402684 )
async def бан( ctx, member: discord.Member, *, reason = None ):
author = ctx.message.author
await ctx.channel.purge( limit = 1 )
await member.ban( reason = reason )
await ctx.send( f'Администратор **{ author.mention }** заблокировал участника { member.mention }' )
#Unban
@client.command( pass_context = True )
@commands.has_any_role( 862924214565339148, 862696882290425886, 870234589967306753, 863300008726888488, 870234350187347978, 870235166688280597, 869042559660478494, 861977273413402684 )
async def разбан(ctx,*, member):
author = ctx.message.author
await ctx.channel.purge( limit = 1 )
banned_users = await ctx.guild.bans()
for ban_entry in banned_users:
user = ban_entry.user
await ctx.guild.unban( user )
await ctx.send( f'Администратор **{ author.mention }** разблокировал { member.mention }' )
return
#Kick
@client.command( pass_context = True )
@commands.has_any_role( 862924214565339148, 862696882290425886, 870234589967306753, 863300008726888488, 870234350187347978, 870235166688280597, 869042559660478494, 861977273413402684 )
async def кик( ctx, member: discord.Member, *, reason = None ):
author = ctx.message.author
await ctx.channel.purge( limit = 1 )
await member.kick( reason = reason )
await ctx.send( f'Администратор **{ author.mention }** выгнал участника { member.mention } с сервера' )
#Mute
@client.command( pass_context = True )
@commands.has_any_role( 862924214565339148, 862696882290425886, 870234589967306753, 863300008726888488, 870234350187347978, 870235166688280597, 869042559660478494, 861977273413402684 )
async def мут( ctx, member: discord.Member ):
author = ctx.message.author
await ctx.channel.purge( limit = 1 )
mute_role = discord.utils.get( ctx.message.guild.roles, name = 'Затычка' )
await member.add_roles( mute_role )
await ctx.send( f'Администратор **{ author.mention }** выдал мут участнику { member.mention }' )```