diff --git a/ubot/modules/danbooru.py b/ubot/modules/danbooru.py index 3fa892e..2863f03 100644 --- a/ubot/modules/danbooru.py +++ b/ubot/modules/danbooru.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -from asyncio import sleep from time import time_ns from telethon import Button @@ -136,17 +135,12 @@ async def danbooru_buttons(event): await event.reply(f"Failed to find URLs for query: {event.args}") return - button_msg = await event.reply( + dan_button_dict[f"{event.chat.id}_{event.id}"] = [0, valid_urls] + + await event.reply( f"[sauce]({DAN_SAUCE_URL}{valid_urls[0][1]})", - file=valid_urls[0][0] - ) - - dan_button_dict[f"{event.chat.id}_{button_msg.id}"] = [0, valid_urls] - - await sleep(1) - - await button_msg.edit( - buttons=[Button.inline('➡️', f'dan*{event.chat.id}_{button_msg.id}*r')] + file=valid_urls[0][0], + buttons=[Button.inline('➡️', f'dan*{event.chat.id}_{event.id}*r')] ) diff --git a/ubot/modules/gelbooru.py b/ubot/modules/gelbooru.py index 2773dfb..a1193ac 100644 --- a/ubot/modules/gelbooru.py +++ b/ubot/modules/gelbooru.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -from asyncio import sleep from random import choice from time import time_ns @@ -146,17 +145,12 @@ async def gelbooru_buttons(event): await event.reply(f"Failed to find URLs for query: {event.args}") return - button_msg = await event.reply( + gel_button_dict[f"{event.chat.id}_{event.id}"] = [0, valid_urls] + + await event.reply( f"[sauce]({GEL_SAUCE_URL}{valid_urls[0][1]})", - file=valid_urls[0][0] - ) - - gel_button_dict[f"{event.chat.id}_{button_msg.id}"] = [0, valid_urls] - - await sleep(1) - - await button_msg.edit( - buttons=[Button.inline('➡️', f'gel*{event.chat.id}_{button_msg.id}*r')] + file=valid_urls[0][0], + buttons=[Button.inline('➡️', f'gel*{event.chat.id}_{event.id}*r')] ) diff --git a/ubot/modules/sankaku.py b/ubot/modules/sankaku.py index 99744c6..85e1af5 100644 --- a/ubot/modules/sankaku.py +++ b/ubot/modules/sankaku.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -from asyncio import sleep from time import time_ns from telethon import Button @@ -137,17 +136,12 @@ async def sankaku_buttons(event): await event.reply(f"Failed to find URLs for query: {event.args}") return - button_msg = await event.reply( + san_button_dict[f"{event.chat.id}_{event.id}"] = [0, valid_urls] + + await event.reply( f"[sauce]({SAN_SAUCE_URL}{valid_urls[0][1]})", - file=valid_urls[0][0] - ) - - san_button_dict[f"{event.chat.id}_{button_msg.id}"] = [0, valid_urls] - - await sleep(1) - - await button_msg.edit( - buttons=[Button.inline('➡️', f'san*{event.chat.id}_{button_msg.id}*r')] + file=valid_urls[0][0], + buttons=[Button.inline('➡️', f'san*{event.chat.id}_{event.id}*r')] )