Closed Agoo1234 closed 5 years ago
@bot.command(pass_context=True)
#@bot.command(pass_context=True)
#@commands.has_permissions(manage_roles = True)
#async def verify(ctx):
# await add_roles(Verified, reason=None, atomic=True)
# await ctx.send("Added role...?")
#@verify.error
#async def verify_error(ctx,error):
# if isinstance(error, commands.MissingPermissions):
# ctx.send("You can't add other roles without the permissions in real life")
#@bot.command(pass_context=True)
#@commands.has_permissions(kick_members = True)
#async def kick(ctx, member : discord.Member, *, reason=None):
# await member.kick(reason=reason)
# await member.channel.send("<@"+discord.Member.id+"> was kicked. \n Reason: "+str(reason))
# channel = bot.get_channel(627286906995998740)
# await channel.send("\n \n "+str(ctx.message.author)+" banned "+str(member)+". \n **Reason:** "+str(reason)+("\n\n **In the Server:** ")+str(ctx.message.guild))
#@kick.error
#async def kick_error(ctx, error):
# if isinstance(error,commands.MissingPermissions):
# await ctx.send(str(member)+" was kicked. \n Reason: "+str(reason))
# print(str(member)+" was kicked. \n Reason: "+str(reason))
@bot.command(pass_context = True)
@commands.has_permissions(ban_members = True)
you have the decorator twice here
@zomatree Thank you! I was so stupid not to notice that!
For future help like this, you should join either the official discord.py server or the Discord API server, as the README also links.
Who can solve this?
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import pyowm
owm = pyowm.OWM('')
TOKEN = ''
prefix = '/'
bot = commands.Bot(command_prefix=prefix) #инициализируем бота с префиксом 'prefix'
@bot.command()
@bot.command(pass_context=True) #разрешаем передавать аргументы
@bot.command()
async def weather(ctx, town) :
await ctx.send("Your town is " + town)
observation = owm.weather_at_place(town)
weather = observation.get_weather()
await ctx.send('In town: ' + town + ' now' + weather)
@bot.command()
async def add(ctx, a: int, b: int):
await ctx.send(a+b)
@bot.command()
async def multiply(ctx, a: int, b: int):
await ctx.send(a*b)
@bot.event
async def on_ready():
activity = discord.Activity(type=discord.ActivityType.listening, name="their masters clebold & KØT")
await bot.change_presence(status=discord.Status.idle, activity=activity)
print('Bot is ready!')
bot.run(TOKEN)
You have two @bot.command
decorators on top of your async
function.
This is not an issue with discord.py, and GitHub issues for this repository should be used to report issues with this library.
For further help specific to using this library, you should join the official discord.py server, as the README recommends.
Summary
So, my bot was working just fine, but then the next time I run it, it keeps giving me the error saying:
TypeError: Callback is already a command.
I checked to see if it meant that I already had a command, but that was the only one. I tried to comment out that command, but then it just went to the next command with the same error. I don't exactly get what it means, so please help.Reproduction Steps
Expected Results
I just want it to stop giving me that error so it can start again.
Actual Results
Checklist
System Information
I am using the latest version of discord.py rewrite(I forgot what it exactly is) and am using Mac OS. The coding softwares I use are IDLE 3.7.3 and repl.it also python3
Here is the link to my code: it is specifically for children, so please don't criticize.