turdbot/py/cogs/repost.py

23 lines
712 B
Python
Raw Normal View History

2023-12-04 13:51:43 -07:00
from discord.ext import bridge, commands
import discord
2023-12-14 18:47:29 -07:00
from bin.storage import storage
#import opencv
#from bin.imagematcher import imagematcher
2023-12-04 13:51:43 -07:00
class Repost(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bridge.bridge_command()
async def repost(self, ctx):
2023-12-14 18:47:29 -07:00
st = storage("test", self.bot.db)
#referenceimgurl = ctx.channel.fetch_message(ctx.message.reference.message_id).attachments[0].url
msgs = await ctx.channel.history(limit=100).flatten()
l = {}
2023-12-04 13:51:43 -07:00
for msg in msgs:
for attachment in msg.attachments:
2023-12-14 18:47:29 -07:00
l[msg.id] = attachment.url
st.db("test", "test", l)
2023-12-04 13:51:43 -07:00
def setup(bot):
bot.add_cog(Repost(bot))