Answer the question
In order to leave comments, you need to log in
Why are the commands in the discord bot not working?
So, I decided to write a bot on the discord and met with the problem that the commands do not work for me, I surfed the Internet and did not find any help and does not give an error
import discord
from discord.ext import commands
from random import *
client = discord.Client()
bot = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print('I has been started - {0.user}'.format(client))
@bot.command()
async def helpme(ctx):
await print('seconds:{}'.format(randint(0,10)))
await ctx.send('Привет, вот мои комманды:\n'
'-/help Вызвать это меню')
@bot.command()
async def greet(ctx):
await ctx.send(":smiley: :wave: Hello, there!")
@client.event
async def on_message(message):
print(message.content)
if message.author == client.user:
return
if 'dexter' in message.content.lower() or 'дэкстер' in message.content.lower():
await message.channel.send('Hi!')
await message.channel.send('Я могу ничего, Ха. Ха')
if '702253949838819438' in message.content:
await message.channel.send('Отстань блять')
try:
bot.add_command(helpme)
bot.add_command(greet)
except:
pass
client.run('ТОКЕН')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question