-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b20a07
commit 954b4ab
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import traceback | ||
|
||
from pyrogram import Client, filters | ||
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup | ||
|
||
from StringBot.modules.generate import generate_session, ask_ques, buttons_ques | ||
|
||
|
||
@Client.on_callback_query(filters.regex(pattern=r"^(generate|pyrogram|pyrogram1|pyrogram_bot|telethon_bot|telethon)$")) | ||
async def _callbacks(bot: Client, callback_query: CallbackQuery): | ||
query = callback_query.matches[0].group(1) | ||
if query == "generate": | ||
await callback_query.answer() | ||
await callback_query.message.reply(ask_ques, reply_markup=InlineKeyboardMarkup(buttons_ques)) | ||
elif query.startswith("pyrogram") or query.startswith("telethon"): | ||
try: | ||
if query == "pyrogram": | ||
await callback_query.answer() | ||
await generate_session(bot, callback_query.message) | ||
elif query == "pyrogram1": | ||
await callback_query.answer() | ||
await generate_session(bot, callback_query.message, old_pyro=True) | ||
elif query == "pyrogram_bot": | ||
await callback_query.answer("» ᴛʜᴇ sᴇssɪᴏɴ ɢᴇɴᴇʀᴀᴛᴇᴅ ᴡɪʟʟ ʙᴇ ᴏғ ᴩʏʀᴏɢʀᴀᴍ ᴠ2.", show_alert=True) | ||
await generate_session(bot, callback_query.message, is_bot=True) | ||
elif query == "telethon_bot": | ||
await callback_query.answer() | ||
await generate_session(bot, callback_query.message, telethon=True, is_bot=True) | ||
elif query == "telethon": | ||
await callback_query.answer() | ||
await generate_session(bot, callback_query.message, telethon=True) | ||
except Exception as e: | ||
print(traceback.format_exc()) | ||
print(e) | ||
await callback_query.message.reply(ERROR_MESSAGE.format(str(e))) | ||
|
||
|
||
ERROR_MESSAGE = "ᴡᴛғ ! sᴏᴍᴇᴛʜɪɴɢ ᴡᴇɴᴛ ᴡʀᴏɴɢ. \n\n**ᴇʀʀᴏʀ** : {} " \ | ||
"\n\n**ᴩʟᴇᴀsᴇ ғᴏʀᴡᴀʀᴅ ᴛʜɪs ᴍᴇssᴀɢᴇ ᴛᴏ @PBX_CHAT**, ɪғ ᴛʜɪs ᴍᴇssᴀɢᴇ " \ | ||
"ᴅᴏᴇsɴ'ᴛ ᴄᴏɴᴛᴀɪɴ ᴀɴʏ sᴇɴsɪᴛɪᴠᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ " \ | ||
"ʙᴇᴄᴀᴜsᴇ ᴛʜɪs ᴇʀʀᴏʀ ɪs **ɴᴏᴛ ʟᴏɢɢᴇᴅ ʙʏ ᴛʜᴇ ʙᴏᴛ** !" |