I just started studying Python this week and I don't understand what I'm doing wrong. My discord bot is online, but every time I try to type a command in Discord it pings back to VS Code as
"discord.ext.commands.errors.CommandNotFound: Command "roll" is not found Ignoring exception in command None:
It's not just roll command, it doesn't seem to be registering any commands. What should I do?
import discord
from discord.ext import commands
import random
TOKEN = 'token hidden'
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')
@bot.command()
async def ping(ctx):
await ctx.send('Pong!')
@client.command()
async def roll(ctx, dice: str):
"""Rolls a dice in NdN format."""
try:
rolls, limit = map(int, dice.split('d'))
except Exception:
await ctx.send('Format has to be in NdN!')
return
result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))
await ctx.send(result)
bot.run(TOKEN)
@botinstead of@client@botthen it works for me - but it needs full command like!roll 4d6- if you don't use parameter then it also may not work. it may raise error but discord may hide it.@bot, it "didn't work"? Could be more specific?