Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Commit 0638a1d

Browse files
committed
multimemes: memify: improve
*Add event when file isnt supported *Delete file after complete *Delete unnecessary codes Signed-off-by: Alfiananda P.A <genengbendo12@gmail.com>
1 parent a5dffb5 commit 0638a1d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

userbot/modules/multimemes.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ async def glitch(event):
115115

116116
@register(outgoing=True, pattern=r"^\.mmf(?: |$)(.*)")
117117
async def mim(event):
118-
if event.fwd_from:
119-
return
120118
if not event.reply_to_msg_id:
121119
await event.edit(
122120
"`Syntax: reply to an image with .mmf` 'text on top' ; 'text on bottom' "
@@ -126,20 +124,20 @@ async def mim(event):
126124
if not reply_message.media:
127125
await event.edit("```reply to a image/sticker/gif```")
128126
return
129-
reply_message.sender
130127
await bot.download_file(reply_message.media)
131-
if reply_message.sender.bot:
132-
await event.edit("```Reply to actual users message.```")
133-
return
134-
else:
128+
if event.is_reply:
129+
data = await check_media(reply_message)
130+
if isinstance(data, bool):
131+
await event.edit("`Unsupported Files...`")
132+
return
133+
135134
await event.edit(
136135
"```Transfiguration Time! Mwahaha Memifying this image! (」゚ロ゚)」 ```"
137136
)
138137
await asyncio.sleep(5)
139138
text = event.pattern_match.group(1)
140139
if event.reply_to_msg_id:
141140
file_name = "meme.jpg"
142-
reply_message = await event.get_reply_message()
143141
to_download_directory = TEMP_DOWNLOAD_DIRECTORY
144142
downloaded_file_name = os.path.join(to_download_directory, file_name)
145143
downloaded_file_name = await bot.download_media(
@@ -153,6 +151,7 @@ async def mim(event):
153151
)
154152
await event.delete()
155153
os.remove(webp_file)
154+
os.remove(dls_loc)
156155

157156

158157
async def draw_meme_text(image_path, text):

0 commit comments

Comments
 (0)