Basically, I've been trying to run this code on repl.it but it just isn't working. I've tried the nest.asyncio and bot.process.commands fixes but they won't work. Basically the bot.event functions work perfectly fine, but the bot.command() won't work. I included an error inside the function so that it would show when the function was called, but it does't call. Here's my code
import discord,os
from discord.ext import commands
import nest_asyncio
import datetime
#Global vars
token = os.getenv("bot_token")
online_message = os.getenv("msg")
bot_name = "My First Bot"
cmd_prefix = "|"
mod_role = "Mod Role Name"
bot = commands.Bot(command_prefix = '-')
bot.remove_command('help')
counter = 0
nest_asyncio.apply()
test_area = bot.get_channel(id=937782074709004309)
# basically triggers (events) that will cause something to happen
@bot.command()
async def ping(ctx):
await ctx.send(f'Pong! {round(bot.latency * 1000)}ms')
hi
@bot.event
async def on_message(message):
global counter
if message.author == bot.user:
return
if message.content.startswith('testin'):
await message.channel.send('hello')
if message.author.id == 583469853126426643 and message.content == (
'do I have a god complex?'):
await message.channel.send('no')
if 'kill' in message.content:
await message.channel.send("please don't murder me")
if message.content.startswith("$"):
counter += 1
await message.channel.send("ya'll have been dumb "+ str(counter) + " times")
if message.content.startswith("!"):
counter += 1
await message.channel.send("ya'll have been dumb "+ str(counter) + " times")
if message.content.startswith('off'):
exit()
return
bot.process_commands(message)
nest_asyncio.apply()
@bot.event
async def on_ready():
await bot.get_channel(id=937782074709004309).send(online_message)
nest_asyncio.apply()
bot.run(token)
I've tried every solution I can find, so discord python users with more knowledge plz help