I\'m setting up a Discord server for me and my friends, and I\'m in need of a bot able to add 20 reactions to any message in which a certain trigger phrase was typed. I used
First of all, you're going to want to change your token now, if you haven't already.
You're using syntax from a version of discord.py, v0.16, that isn't supported anymore.
See the guide for migrating to v1, specifically the Models are Stateful section.
You should use Message.add_reaction rather than Bot.add_reaction
.
You're looking at old tutorials. Client.add_reaction
was moved to Message.add_reaction in discord.py 1.0
The functionality you describe could look something like:
default_emojis = [
"\N{GRINNING FACE}",
"\N{KEYCAP DIGIT ONE}"
]
custom_emojis = [
"war_tank"
]
async def react(message):
for emoji in default_emojis:
await message.add_reaction(emoji)
for emoji in message.guild.emojis:
if emoji.name in custom_emojis:
await message.add_reaction(emoji)
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if "react to me" in message.content.lower():
await react(message)