insert2-cogs/starboard.py

31 lines
992 B
Python
Raw Normal View History

2024-12-26 17:13:02 +00:00
import nextcord
from nextcord.ext import commands
from nextcord import TextInputStyle
from dotenv import load_dotenv
from random import randint
import aiosqlite as sqlite3
import json
import traceback
import sys
from datetime import datetime
import base64
from urllib.parse import urlparse
import os
class starboard(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.Cog.listener('on_raw_reaction_add')
async def on_raw_reaction_add(self,payload):
2024-12-26 17:20:25 +00:00
print("recieved emoji payload", file=sys.stderr)
2024-12-26 17:23:41 +00:00
print(payload.emoji.name, file=sys.stderr)
if payload.emoji.name == "":
2024-12-26 17:20:25 +00:00
print("Recieved star payload", file=sys.stderr)
2024-12-26 17:13:02 +00:00
chann = self.bot.get_channel(payload.channel_id)
2024-12-26 17:27:55 +00:00
message = await chann.fetch_message(payload.message_id)
await message.forward(chann)
await chann.send("forwarded message")
2024-12-26 17:13:02 +00:00
def setup(bot: commands.Bot):
bot.add_cog(starboard(bot))