To further develop this you need to fully understand what you’ve done and have a plan for what you want to do. I will first direct you to the discord python documentation Where you can see everything discord.py has to offer. This should probably be your first stop when you have questions.
I see you have
import discord and
from discord.ext import commands… discord.py has two ways to approach a bot, which you have:
client = discord.Client() hails from
import discord, and
bot = commands.Bot() hails from
You need to choose whether to use
discord.Bot() because the use cases are entirely different. I suggest the latter, as it will allow your bot to do more, in a cleaner fashion.
Your next step would be to change any @ decorators to whichever variable you choose and keep that consistent throughout your code. Then, you need to remove whichever
.run(TOKEN) you won’t use. So, if I were you, I would read the documentation which I linked to you so you understand more than a YouTube tutorial would teach.
As for a revision to your code, it would look like this:
import os import discord from dotenv import load_dotenv from discord.ext import commands load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') GUILD = os.getenv('DISCORD_GUILD') bot = commands.Bot(command_prefix='$') @bot.command(name='repeat', help='help me to understand bots') async def test(ctx, *args): for arg in args: await ctx.send(arg) @bot.event async def on_raw_reaction_add(payload): print("someone reacted to something") print(payload) bot.run(TOKEN)
CLICK HERE to find out more related problems solutions.