Discord bot discord.py commands aren't working
I'm fairly new to making discord bots, and I'm trying to make a basic test command, where you say (prefix)test abc, and the bot says abc too. I get no errors, but when I type r!test abc, nothing happens. I get nothing in the terminal, either.
Here is my code.
import discord
from dotenv import load_dotenv
from discord.ext import commands
load_dotenv()
GUILD = os.getenv('DISCORD_GUILD') # Same thing but gets the server name
client = discord.Client()
bot = commands.Bot(command_prefix='r!')
TOKEN = 'TOKENGOESHERE'
on = "I'm up and running!"
print("Booting up...")
channel = client.get_channel(703869904264101969)
@client.event # idk what this means but you have to do it
async def on_ready(): # when the bot is ready
for guild in client.guilds:
if guild.name == GUILD:
break
print(f'{client.user} has connected to Discord! They have connected to the following server: ' #client.user is just the bot name
f'{guild.name}(id: {guild.id})' # guild.name is just the server name
)
channel2 = client.get_channel(channelidishere)
await channel2.send(on)
#everything works up until I get to here, when I run the command, nothing happens, not even some output in the terminal.
@commands.command()
async def test(ctx):
await ctx.send("test")
client.run(TOKEN)
Thanks everyone!