Skip to content

Commit

Permalink
evened
Browse files Browse the repository at this point in the history
  • Loading branch information
prgofficial committed Mar 5, 2021
1 parent 9562dc5 commit b47d95a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
9 changes: 6 additions & 3 deletions helpers/tools.py
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
45 changes: 33 additions & 12 deletions plugins/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
8 changes: 4 additions & 4 deletions plugins/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions script.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# By @TroJanzHEX

class Script(object):

START_MSG = """<b>Hello {},
I'm a Subtitle Tranlsator Bot which Supports 100+ Languages using Google Translate API.
Expand All @@ -11,6 +12,7 @@ class Script(object):
© @TroJanzHEX</b>"""


HELP_MSG = """<b>Hai, Follow these Steps..</b>
🌀 <code>Send me any Valid SRT Subtitle file to Translate.</code>
Expand All @@ -21,6 +23,7 @@ class Script(object):
© @TroJanzHEX"""


ABOUT_MSG = """⭕️<b>My Name : Subtitle Translator Bot</b>
⭕️<b>Language :</b> <code>Python3</code>
Expand Down

0 comments on commit b47d95a

Please sign in to comment.