0
import discord
from discord.ext import commands
import random

print("Starting bot...")

TOKEN = (the token)
client = commands.Bot(command_prefix='?')


# answers with the ms latency
@client.command(name='ping', pass_context = True)
async def ping(ctx):
    await ctx.send(f'Pong! {round(client.latency * 1000)}ms ')
client.run(TOKEN)

it runs any on_message commands but not anything else. I've looked at many tutorial sites and pages in S-O but none seem to work.

  • Thanks for posting the question. It would be helpful if you provided a specific example of the behavior, e.g. what did you try to run and what was a result? Was there any exception thrown, and what was it? What else did you try to change this behavior, e.g. parameter changes... – TeilaRei Aug 26 '20 at 19:30
  • Hey, thanks for responding, there was no exception thrown, just I say a command and it doesn't happen. They will only respond to on_message(). Do I write the command before the on_message()s? – Quacky Moo Aug 26 '20 at 21:01
  • The on_message() is below the function and yet it makes no difference. – Quacky Moo Aug 26 '20 at 21:08
  • hmmm... it works if i remove the on_message function. why is that? – Quacky Moo Aug 26 '20 at 22:04
  • check this question, it may already have the answer: https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working – TeilaRei Aug 26 '20 at 22:27
  • Yes, I had fixed it, but thank you. – Quacky Moo Aug 27 '20 at 01:14

1 Answers1

0

Check TeilaRei's last post, you need to add a line to to on_message().