diff --git a/helpers/tools.py b/helpers/tools.py index 45372de..dc203ca 100644 --- a/helpers/tools.py +++ b/helpers/tools.py @@ -1,14 +1,17 @@ import os import shlex import asyncio + from typing import Tuple async def execute(cmnd: str) -> Tuple[str, str, int, int]: cmnds = shlex.split(cmnd) - process = await asyncio.create_subprocess_exec(*cmnds, - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE) + process = await asyncio.create_subprocess_exec( + *cmnds, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE + ) stdout, stderr = await process.communicate() return (stdout.decode('utf-8', 'replace').strip(), stderr.decode('utf-8', 'replace').strip(), diff --git a/plugins/callback.py b/plugins/callback.py index e586f9b..2e9b46b 100644 --- a/plugins/callback.py +++ b/plugins/callback.py @@ -17,28 +17,49 @@ async def cb_handler(client, query): if query.data == "start_data": await query.answer() - keyboard = InlineKeyboardMarkup([[InlineKeyboardButton("HELP", callback_data="help_data"), InlineKeyboardButton("ABOUT", callback_data="about_data"), ], - [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")]]) - - await query.message.edit_text(Script.START_MSG.format(query.from_user.mention), reply_markup=keyboard, disable_web_page_preview=True) + keyboard = InlineKeyboardMarkup([ + [InlineKeyboardButton("HELP", callback_data="help_data"), + InlineKeyboardButton("ABOUT", callback_data="about_data")], + [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")] + ]) + + await query.message.edit_text( + Script.START_MSG.format(query.from_user.mention), + reply_markup=keyboard, + disable_web_page_preview=True + ) return elif query.data == "help_data": await query.answer() - keyboard = InlineKeyboardMarkup([[InlineKeyboardButton("BACK", callback_data="start_data"), InlineKeyboardButton("ABOUT", callback_data="about_data"), ], - [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")]]) - - await query.message.edit_text(Script.HELP_MSG, reply_markup=keyboard, disable_web_page_preview=True) + keyboard = InlineKeyboardMarkup([ + [InlineKeyboardButton("BACK", callback_data="start_data"), + InlineKeyboardButton("ABOUT", callback_data="about_data")], + [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")] + ]) + + await query.message.edit_text( + Script.HELP_MSG, + reply_markup=keyboard, + disable_web_page_preview=True + ) return elif query.data == "about_data": await query.answer() - keyboard = InlineKeyboardMarkup([[InlineKeyboardButton("BACK", callback_data="help_data"), InlineKeyboardButton("START", callback_data="start_data"), ], - [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")]]) - - await query.message.edit_text(Script.ABOUT_MSG, reply_markup=keyboard, disable_web_page_preview=True) + keyboard = InlineKeyboardMarkup([ + [InlineKeyboardButton("BACK", callback_data="help_data"), + InlineKeyboardButton("START", callback_data="start_data")], + [InlineKeyboardButton("SOURCE CODE", url="https://github.com/TroJanzHEX/Subtitle-Translator")] + ]) + + await query.message.edit_text( + Script.ABOUT_MSG, + reply_markup=keyboard, + disable_web_page_preview=True + ) return diff --git a/plugins/extractor.py b/plugins/extractor.py index 1d66a71..86d0e3b 100644 --- a/plugins/extractor.py +++ b/plugins/extractor.py @@ -15,10 +15,10 @@ async def confirm_dwnld(client, message): await message.reply_text( "**Select the Optins Below**", quote=True, - reply_markup=InlineKeyboardMarkup( - [[InlineKeyboardButton(text="DOWNLOAD", callback_data="download_file")], - [InlineKeyboardButton(text="CANCEL", callback_data="close")]] - ) + reply_markup=InlineKeyboardMarkup([ + [InlineKeyboardButton(text="DOWNLOAD", callback_data="download_file")], + [InlineKeyboardButton(text="CANCEL", callback_data="close")] + ]) ) else: await message.reply_text( diff --git a/script.py b/script.py index 5419f49..be77b68 100644 --- a/script.py +++ b/script.py @@ -1,6 +1,7 @@ # By @TroJanzHEX class Script(object): + START_MSG = """Hello {}, I'm a Subtitle Tranlsator Bot which Supports 100+ Languages using Google Translate API. @@ -11,6 +12,7 @@ class Script(object): © @TroJanzHEX""" + HELP_MSG = """Hai, Follow these Steps.. 🌀 Send me any Valid SRT Subtitle file to Translate. @@ -21,6 +23,7 @@ class Script(object): © @TroJanzHEX""" + ABOUT_MSG = """⭕️My Name : Subtitle Translator Bot ⭕️Language : Python3