Skip to content

Instantly share code, notes, and snippets.

@typemytype
Last active January 16, 2023 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typemytype/00b60296f1242acd8d7313fec8966a7a to your computer and use it in GitHub Desktop.
Save typemytype/00b60296f1242acd8d7313fec8966a7a to your computer and use it in GitHub Desktop.
import os
import discord
from discord.ext import commands
TOKEN = os.getenv("BOOKMARK_BOT_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
intents.reactions = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print("Bookmark Bot Started!")
@client.event
async def on_raw_reaction_add(payload):
channel = await client.fetch_channel(payload.channel_id)
message = await channel.fetch_message(payload.message_id)
user = await client.fetch_user(payload.user_id)
emoji = payload.emoji
pmChannel = await user.create_dm()
if channel != pmChannel and str(emoji) == "🔖":
embed = discord.Embed(
title="Message:",
url=message.jump_url,
description=message.content,
color=0xFF5733
)
embed.set_author(
name=author.display_name,
icon_url=author.display_avatar
)
await user.send(embed=embed)
if channel == pmChannel and str(emoji) == "❌":
await message.delete()
# Run the bot
client.run(TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment