1

I´d like to know how to register my command so it will be visible in text-line when you write, so the whisperer whispers command help This is my code:

import discord
from discord.ext import commands
import random
import nest_asyncio
nest_asyncio.apply()

intents = discord.Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix='!', intents=intents)


@bot.event
async def on_ready():
    print(f'Logged in as {bot.user} (ID: {bot.user.id})')
    print('------')
            
@bot.command()
async def randomnumber(ctx, howmuch):
    x = 0
    if howmuch >= "5":
        await ctx.send("Are you kidding!?")
    else:
        while str(x) < howmuch:
            x += 1
            await ctx.send(random.random())


@bot.command()
async def purge(ctx):
    print("Command disabled.")
    
    
@bot.command()
async def cookie(ctx):
    await ctx.send("Cookies!")
    cookie = discord.File("cookie.jpg")
    await ctx.send(file = cookie)
    print("Cookies!")

    
    
    
    
bot.run("My bot token")

I thought it is enough, but I found out it is not. Please help and sorry for my english. Thank you.

Jake
  • 19
  • 4
  • If I understood correctly, you're talking about the commands that pop up when you type "/", am I right? Those are application commands. (aka slash commands) – Raymus Mar 08 '23 at 12:26
  • Yes, you understand correctly, @Raymus – Jake Mar 08 '23 at 12:29
  • You can read more about slash commands [here](https://stackoverflow.com/questions/71165431/how-do-i-make-a-working-slash-command-in-discord-py) – Raymus Mar 08 '23 at 12:33

0 Answers0