Задать вопрос
@sbuw

Ошибка при создания бота Discord на python. Как решить?

Traceback (most recent call last):
  File "bot.py", line 55, in <module>
    async def help(ctx):
  File "C:\Users\Егор\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 1262, in decorator
    result = command(*args, **kwargs)(func)
  File "C:\Users\Егор\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 1432, in decorator
    raise TypeError('Callback is already a command.')
TypeError: Callback is already a command.
sys:1: RuntimeWarning: coroutine 'Command.__call__' was never awaited


Помогите решить проблему

import discord
from discord.ext import commands
import sqlite3

client = commands.Bot(command_prefix='!')

# help clear
@client.remove_command('help')

@client.event
async def on_ready():
	print('SolaBot готов к полёту!')
 

# Clear message
@client.command(pass_context = True)
@commands.has_permissions(administrator = 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}')

# 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.send(f'ban {member.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'Kick {member.mention}')


# Mute
@client.command()
@commands.has_permissions(administrator = True)


# !help
@client.command(pass_context = True)
@commands.has_permissions(administrator = True)

async def help(ctx):
	await ctx.channel.purge(limit = 1)
	emb = discord.Embed(title = "Навигация по командам", colour = discord.Color.purple())
	emb.add_field(name = '{}clear'.format('!'), value = 'Очистка чата')
	emb.add_field(name = '{}kick'.format('!'), value = 'Удаления участика с сервера')
	emb.add_field(name = '{}ban'.format('!'), value = 'Ограничения доступа к серверу')
	emb.add_field(name = '{}hello'.format('!'), value = 'Разговор с ботом')
	emb.add_field(name = '{}bot'.format('!'), value = 'Online?')


	await ctx.send(embed = emb)



# Bot Online?
@client.command()
async def bot(ctx):
	await ctx.send(f' Bot Online! ')


# add role(join)
@client.event
async def on_member_join(member):
	channel = clinet.get.channel(839781279859081219)
	role = discord.utiles.get(member.guild.roles, id = 840530023782154317)
	await member.add_roles(role)
	await channel.send(emb = discord.Embed(descripttion = f'Пользователь ``{member.name}``, теперь с нами!', color = 0x0))


#Connect
token = open('token.txt', 'r').readline()
client.run(token)
  • Вопрос задан
  • 691 просмотр
Подписаться 1 Простой Комментировать
Решения вопроса 1
SoreMix
@SoreMix Куратор тега Python
yellow
# Mute
@client.command()
@commands.has_permissions(administrator = True)

# !help
@client.command(pass_context = True)
@commands.has_permissions(administrator = True)

async def help(ctx):


На одну функцию прицепили одинаковые декораторы
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы