Ошибка:
Traceback (most recent call last):
File "bot.py", line 67, in <module>
async def help ( ctx ):
File "C:\Users\Phlerows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 1229, in decorator
self.add_command(result)
File "C:\Users\Phlerows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 1131, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
Код:
import discord
from discord.ext import commands
PREFIX = '/'
client = commands.Bot( command_prefix = PREFIX )
@client.event
async def on_ready():
print( 'Bot Online' )
# Clear message
@client.command( pass_context = True )
async def clear( ctx, amount = 100):
await ctx.channel.purge( limit = amount )
#Clear command
@client.command ( pass_context = True )
async def hello( ctx, amount = 1):
await ctx.channel.purge ( limit = amount )
author = ctx.message.author
await ctx.send( f'hello { author.mention }' )
#kick
@client.command( pass_context = True )
@commands.has_permissions( administrator = True )
async def kick( ctx, member: discord.Member, *, reason = None ):
await ctx.channel.purge( limit = 1 )
await member.kick( reason = reason )
await ctx.send(f'У { member.mention } кик, за нарушение правил сервера' )
#Ban
@client.command( pass_context = True )
@commands.has_permissions( administrator = True )
async def ban( ctx, member: discord.Member, *, reason = None ):
await ctx.channel.purge( limit = 1 )
await member.ban( reason = reason )
await ctx.print(f'У { member.mention } бан, за нарушение правил сервера' )
#Unban
@client.command( pass_context = True )
async def unban( ctx, *,member):
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.print(f'Разбан { member.mention }' )
return
# Command help
@client.command( )
@commands.has_permissions( administrator = True )
async def help ( ctx ):
emb = discord.Ember ( title = 'Навигация по командам' )
emb.add_field( name = '{}clear'.format( PREFIX ), value = 'Очистка чата' )
emb.add_field( name = '{}kick'.format( PREFIX ), value = 'Удаление участника с сервера' )
emb.add_field( name = '{}ban'.format( PREFIX ), value = 'Ограничение доступа к серверу' )
emb.add_field( name = '{}mute'.format( PREFIX ), value = 'Ограничение доступа к чату' )
emb.add_field( name = '{}unban'.format( PREFIX ), value = 'Удаление ограничение доступа к серверу' )
emb.add_field( name = '{}unmute'.format( PREFIX ), value = 'Удаление ограничение доступа к чату' )
await ctx.send( embed = emb )
#mute
@client.command( pass_context = True )
@commands.has_permissions( administrator = True )
async def mute( ctx, member: discord.Member ):
await ctx.channel.purge( limit = 1 )
mute_role = discord.utils.get( ctx.message.guild.roles, name = 'Mute' )
await member.add_roless( mute_role )
await ctx.print(f'У { member.mention }, ограничение чата, за нарушение прав!' )
#Get token
token = open ( 'token.txt', 'r' ).readline()
client.run (token)