Im trying to make a discord bot, and I want its first command to be pretty simple, I just want it to respond "pong!" when someone types "!ping" but when I try to run the command, nothing happens.. I've tried using other commands too but they all result in errors.. I'm a beginner to using Python, so please, can someone tell me what's wrong with my code, and how I can fix it?
In short, my bot doesn't respond back when I type the command I made for it to do so.
import discord
import os
from discord.ext import commands
from discord.ext.commands import Bot
case_insensitive=True
client = discord.Client()
bot = commands.Bot(
command_prefix="!",
intents=discord.Intents(members=True, messages=True, guilds=True)
)
@client.event
async def on_ready():
print('logged in as {0.user}!'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
@bot.command(name="ping", description= "Find out!")
async def ping(ctx):
await ctx.send("Pong!")
client.run(os.getenv('TOKEN'))