Last active
January 16, 2023 15:11
-
-
Save typemytype/00b60296f1242acd8d7313fec8966a7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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