'Why doesn't @bot.command() work in my discord bot?
I made my Discord bot, but here the bot doesn't work anymore. There are none issues in the console. Where is my mistake?
This is my 2nd Class (Commands.py). My Bot has all permissions in the Developement Portal what it really need.
My 1st Class (main.py) works perfect.
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
def caps_pls(text):
return text.upper()
@bot.command()
async def say(ctx, *, arg):
await ctx.send(arg)
@say.error
async def say_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Bitte schreibe, was ich sagen soll.🗣️')
@bot.command()
async def caps(ctx, *, arg: caps_pls):
await ctx.send(arg)
@caps.error()
async def caps_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Bitte schreibe mir, was ich schreien soll. 😮')
@bot.commands()
async def kill(ctx, member: discord.Member):
await ctx.send(f'{member.display_name} wurde gekillt. 🔪')
@kill.error
async def kill_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('Ich kann diesen Member nicht finden.')
@bot.commands()
async def kiss(ctx, member: discord.Member):
await ctx.send(f'{member.display_name} wurde geküsst. 👄')
@kiss.error
async def kiss_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('Ich kann diesen Member nicht finden.')
bot.run('TOKEN')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
