Answer the question
In order to leave comments, you need to log in
Why is the discord bot not responding to the command?
I have a bot with this code
import asyncio
import random
import discord
from discord.ext import commands
intents = discord.Intents.all()
client = commands.Bot(command_prefix='!', intents=intents)
@client.event
async def on_ready():
print('Бот уже попущенный')
w1 = [0,1,0,0,0,1] #(можешь еще добавить, сколько душе угодно(0, 2, 3, 4... - Не даст роль, 1 - даст роль))
@client.command()
async def chest(message):
if message.channel != 903198062963490827:
return
if message.author == py.user: # (проверка на сообщение от бота(игнорируем))
return
w2 = random.choice(w1)
if w2 == 1:
guild = message.guild
channel = message.channel
user = message.author # (чисто для удобства упрощаем вид)
await channel.send('ТЫ ПОПАЛ В ПОДВАЛ, ХА-ХА-ХА')
if w2 == 0:
await channel.send('нюхай')
await asyncio.sleep(120)
client.run('')
Answer the question
In order to leave comments, you need to log in
In async def chest(message): there should be a ctx parameter instead of message (i.e. async def chest(ctx):)
And also replace everything from message to ctx in the command code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question