From 16fe388090d5aff5fa4573de88f5f478062dc1da Mon Sep 17 00:00:00 2001 From: Aryn <63111101+arynyklas@users.noreply.github.com> Date: Fri, 15 Oct 2021 21:34:21 +0600 Subject: [PATCH 1/4] Added inline button to redirect into haste --- aiogram_bot/handlers/hastebin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aiogram_bot/handlers/hastebin.py b/aiogram_bot/handlers/hastebin.py index e651f09..ad8c8ac 100644 --- a/aiogram_bot/handlers/hastebin.py +++ b/aiogram_bot/handlers/hastebin.py @@ -41,7 +41,13 @@ async def command_paste(message: types.Message): url=md.hlink("HasteBin", document_url), size=len(content), ) - await dst.reply(text, allow_sending_without_reply=True) + + reply_markup = types.InlineKeyboardMarkup( + _("Open paste"), + url=document_url + ) + + await dst.reply(text, allow_sending_without_reply=True, reply_markup=reply_markup) for message_to_delete in messages_to_delete: with suppress(TelegramAPIError): From f3b80b6927d5b5f95faa2b4eedabf84b260ce0e1 Mon Sep 17 00:00:00 2001 From: Aryn <63111101+arynyklas@users.noreply.github.com> Date: Fri, 15 Oct 2021 21:36:15 +0600 Subject: [PATCH 2/4] Update bot.pot --- locales/bot.pot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/locales/bot.pot b/locales/bot.pot index 0b2915b..b498188 100644 --- a/locales/bot.pot +++ b/locales/bot.pot @@ -118,6 +118,10 @@ msgid "" "Content size: {size} bytes" msgstr "" +#: aiogram_bot/handlers/hastebin.py:46 +msgid "Open paste" +msgstr "" + #: aiogram_bot/handlers/new_chat_members.py:72 msgid "I'm bot" msgstr "" From 31ccaf86a3fbc27812b24f2b8e67231899e9ff11 Mon Sep 17 00:00:00 2001 From: Aryn <63111101+arynyklas@users.noreply.github.com> Date: Tue, 19 Oct 2021 20:00:42 +0600 Subject: [PATCH 3/4] Fixe inline keyboard --- aiogram_bot/handlers/hastebin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aiogram_bot/handlers/hastebin.py b/aiogram_bot/handlers/hastebin.py index ad8c8ac..078598d 100644 --- a/aiogram_bot/handlers/hastebin.py +++ b/aiogram_bot/handlers/hastebin.py @@ -43,8 +43,10 @@ async def command_paste(message: types.Message): ) reply_markup = types.InlineKeyboardMarkup( - _("Open paste"), - url=document_url + types.InlineKeyboardButton( + _("Open paste"), + url=document_url + ) ) await dst.reply(text, allow_sending_without_reply=True, reply_markup=reply_markup) From 6c0e47faab22bae9a13a4797cdcf644f1383728b Mon Sep 17 00:00:00 2001 From: Aryn <63111101+arynyklas@users.noreply.github.com> Date: Tue, 19 Oct 2021 20:09:19 +0600 Subject: [PATCH 4/4] Update hastebin.py --- aiogram_bot/handlers/hastebin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/aiogram_bot/handlers/hastebin.py b/aiogram_bot/handlers/hastebin.py index 078598d..4a74d70 100644 --- a/aiogram_bot/handlers/hastebin.py +++ b/aiogram_bot/handlers/hastebin.py @@ -42,12 +42,11 @@ async def command_paste(message: types.Message): size=len(content), ) - reply_markup = types.InlineKeyboardMarkup( - types.InlineKeyboardButton( - _("Open paste"), - url=document_url - ) - ) + reply_markup = types.InlineKeyboardMarkup() + reply_markup.add(types.InlineKeyboardButton( + _("Open paste"), + url=document_url + )) await dst.reply(text, allow_sending_without_reply=True, reply_markup=reply_markup)