Skip to content

Instantly share code, notes, and snippets.

@abiriadev
Created June 25, 2021 19:05
Show Gist options
  • Save abiriadev/2023d8ef96863328d597b79674cd3f13 to your computer and use it in GitHub Desktop.
Save abiriadev/2023d8ef96863328d597b79674cd3f13 to your computer and use it in GitHub Desktop.
discord.py reactions
import discord, asyncio, os
from discord.guild import Guild
from dotenv import load_dotenv
load_dotenv()
client = discord.Client(
intents=discord.Intents(
dm_reactions=True,
guild_reactions=True,
guilds=True,
members=True,
messages=True,
)
)
@client.event
async def on_ready():
print("I'm Ready!")
print(client.intents)
print(f"intents.members: {client.intents.members}")
print(f"intents.reactions: {client.intents.reactions}")
print(f"intents.dm_reactions: {client.intents.dm_reactions}")
@client.event
async def on_message(msg):
args = msg.content.split(" ")
if args[0] == "echo":
await msg.channel.send(args[1])
@client.event
async def on_reaction_add(reaction, user):
await reaction.message.channel.send(
f"hey {user}, thanks to reaction! {reaction.emoji}"
)
client.run(os.environ["TOKEN"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment