how do i put command in my bot | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how do i put command in my bot

from discord.ext import commands import asyncio import discord import random """A SIMPLE DISCORD BOT USING DISCORD.PY""" bot=commands.Bot(command_prefix='s.') #command prefix @bot.event async def on_ready(): """Print the bot's name when the bot is ready'""" print(bot.user.name) @bot.command(pass_context=True) async def say(con,*,msg): """Repeats what the user says""" await bot.say(msg) @bot.command(pass_context=True) async def dice(con,x=1,y=6): await bot.say(random.randint(x,y)) bot.run('ur bot token') # ↑that the code ↑ https://code.sololearn.com/cffLFiT5841K/?ref=app

10th Feb 2022, 12:03 PM
Glitching shift Sans
Glitching shift Sans - avatar
1 Answer
0
Try with @bot.command() async def say(ctx, msg): await ctx.send(msg)
11th Feb 2022, 7:08 PM
David Martínez Castañón
David Martínez Castañón - avatar