From 2192624ef8e41271c3e949adc7a07cbffb957005 Mon Sep 17 00:00:00 2001 From: samsunghappytree123 Date: Sun, 19 Mar 2023 18:21:33 +0900 Subject: [PATCH] feat(cogs.meme): edit meme url, add meme msg id --- cogs/meme.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cogs/meme.py b/cogs/meme.py index c95820c..e2ad622 100644 --- a/cogs/meme.py +++ b/cogs/meme.py @@ -458,8 +458,8 @@ async def meme_upload_file( filename = f"{str(ctx.author.id)}-{(datetime.datetime.utcnow() + datetime.timedelta(hours=9)).strftime('%Y%m%d-%H%M%S')}.{url.split('.')[-1]}" try: - img_msg = await self.bot.get_channel(852811274886447114).send( - content=f"{ctx.author.mention}({ctx.author.id})", + img_msg = await self.bot.get_channel(config.BOT.MEME_CHANNEL).send( + content=f"{ctx.author.mention} (`{ctx.author.id}`)", file=await file.to_file(), allowed_mentions=discord.AllowedMentions.none(), ) @@ -507,7 +507,7 @@ def check(inter): ) if interaction_check.data["custom_id"] == "yes_button": - await MEME_DATABASE.insert(title=title, url=url, uploader_id=ctx.author.id) + await MEME_DATABASE.insert(title=title, url=img_msg.attachments[0].url, messageID=img_msg.id, uploader_id=ctx.author.id) return await ctx.edit( content=f"{ctx.author.mention}, 짤 등록이 완료되었어요!", embed=None, @@ -556,8 +556,8 @@ async def meme_upload_link( await f.write(await resp.read()) try: - img_msg = await self.bot.get_channel(852811274886447114).send( - content=f"{ctx.author.mention}({ctx.author.id})", + img_msg = await self.bot.get_channel(config.BOT.MEME_CHANNEL).send( + content=f"{ctx.author.mention} (`{ctx.author.id}`)", file=discord.File(filename), allowed_mentions=discord.AllowedMentions.none(), ) @@ -607,7 +607,7 @@ def check(inter): ) if interaction_check.data["custom_id"] == "yes_button": - await MEME_DATABASE.insert(title=title, url=url, uploader_id=ctx.author.id) + await MEME_DATABASE.insert(title=title, url=img_msg.attachments[0].url, messageID=img_msg.id, uploader_id=ctx.author.id) return await ctx.edit( content=f"{ctx.author.mention}, 짤 등록이 완료되었어요!", embed=None,