This commit is contained in:
yasir 2023-02-03 22:03:29 +07:00
parent b9aed07f83
commit de4dbb8f32
3 changed files with 28 additions and 21 deletions

View file

@ -157,10 +157,11 @@ async def start(_, message):
f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n" f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n"
+ HELPABLE[module].__HELP__ + HELPABLE[module].__HELP__
) )
await message.reply(text, disable_web_page_preview=True) await kirimPesan(message, text, disable_web_page_preview=True)
elif name == "help": elif name == "help":
text, keyb = await help_parser(message.from_user.first_name) text, keyb = await help_parser(message.from_user.first_name)
await message.reply( await kirimPesan(
message,
text, text,
reply_markup=keyb, reply_markup=keyb,
) )
@ -214,14 +215,15 @@ async def help_command(_, message):
], ],
] ]
) )
await message.reply( await kirimPesan(
message,
f"Click on the below button to get help about {name}", f"Click on the below button to get help about {name}",
reply_markup=key, reply_markup=key,
) )
else: else:
await message.reply("PM Me For More Details.", reply_markup=keyboard) await kirimPesan(message, "PM Me For More Details.", reply_markup=keyboard)
else: else:
await message.reply("Pm Me For More Details.", reply_markup=keyboard) await kirimPesan(message, "Pm Me For More Details.", reply_markup=keyboard)
else: else:
if not await db.is_user_exist(message.from_user.id): if not await db.is_user_exist(message.from_user.id):
await db.add_user(message.from_user.id, message.from_user.first_name) await db.add_user(message.from_user.id, message.from_user.first_name)
@ -237,18 +239,19 @@ async def help_command(_, message):
f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n" f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n"
+ HELPABLE[name].__HELP__ + HELPABLE[name].__HELP__
) )
await message.reply(text, disable_web_page_preview=True) await kirimPesan(message, text, disable_web_page_preview=True)
else: else:
text, help_keyboard = await help_parser(message.from_user.first_name) text, help_keyboard = await help_parser(message.from_user.first_name)
await message.reply( await kirimPesan(
message,
text, text,
reply_markup=help_keyboard, reply_markup=help_keyboard,
disable_web_page_preview=True, disable_web_page_preview=True,
) )
else: else:
text, help_keyboard = await help_parser(message.from_user.first_name) text, help_keyboard = await help_parser(message.from_user.first_name)
await message.reply( await kirimPesan(
text, reply_markup=help_keyboard, disable_web_page_preview=True message, text, reply_markup=help_keyboard, disable_web_page_preview=True
) )
return return
@ -291,7 +294,8 @@ General command are:
module = mod_match[1].replace(" ", "_") module = mod_match[1].replace(" ", "_")
text = f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n{HELPABLE[module].__HELP__}" text = f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n{HELPABLE[module].__HELP__}"
await query.message.edit( await editPesan(
query.message,
text=text, text=text,
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
[[InlineKeyboardButton("back", callback_data="help_back")]] [[InlineKeyboardButton("back", callback_data="help_back")]]
@ -307,7 +311,8 @@ General command are:
await query.message.delete() await query.message.delete()
elif prev_match: elif prev_match:
curr_page = int(prev_match[1]) curr_page = int(prev_match[1])
await query.message.edit( await editPesan(
query.message,
text=top_text, text=top_text,
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
paginate_modules(curr_page - 1, HELPABLE, "help") paginate_modules(curr_page - 1, HELPABLE, "help")
@ -317,7 +322,8 @@ General command are:
elif next_match: elif next_match:
next_page = int(next_match[1]) next_page = int(next_match[1])
await query.message.edit( await editPesan(
query.message,
text=top_text, text=top_text,
reply_markup=InlineKeyboardMarkup( reply_markup=InlineKeyboardMarkup(
paginate_modules(next_page + 1, HELPABLE, "help") paginate_modules(next_page + 1, HELPABLE, "help")
@ -326,7 +332,8 @@ General command are:
) )
elif back_match: elif back_match:
await query.message.edit( await editPesan(
query.message,
text=top_text, text=top_text,
reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")), reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")),
disable_web_page_preview=True, disable_web_page_preview=True,
@ -334,7 +341,8 @@ General command are:
elif create_match: elif create_match:
text, keyboard = await help_parser(query) text, keyboard = await help_parser(query)
await query.message.edit( await editPesan(
query.message,
text=text, text=text,
reply_markup=keyboard, reply_markup=keyboard,
disable_web_page_preview=True, disable_web_page_preview=True,

View file

@ -18,10 +18,9 @@ async def task(msg, warn = False, sec = None):
def wait(sec): def wait(sec):
async def ___(flt, cli, msg): async def ___(flt, cli, msg):
user_id = msg.from_user.id user_id = msg.from_user.id
timestamp = time.mktime(msg.date.timetuple())
if user_id in data: if user_id in data:
if timestamp >= data[user_id]['timestamp'] + flt.data: if msg.date.timestamp() >= data[user_id]['timestamp'] + flt.data:
data[user_id] = {'timestamp' : msg.date, 'warned' : False} data[user_id] = {'timestamp' : msg.date.timestamp(), 'warned' : False}
return True return True
else: else:
if not data[user_id]['warned']: if not data[user_id]['warned']:
@ -32,6 +31,6 @@ def wait(sec):
asyncio.ensure_future(task(msg)) asyncio.ensure_future(task(msg))
return False return False
else: else:
data.update({user_id : {'timestamp' : timestamp, 'warned' : False}}) data.update({user_id : {'timestamp' : msg.date.timestamp(), 'warned' : False}})
return True return True
return filters.create(___, data=sec) return filters.create(___, data=sec)

View file

@ -89,7 +89,7 @@ async def shell(_, m):
file_name=doc.name, file_name=doc.name,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
) )
await m.delete if m.from_user.is_self else await msg.delete() await m.delete() if m.from_user.is_self else await msg.delete()
try: try:
os.remove("shell_output.txt") os.remove("shell_output.txt")
except: except:
@ -147,13 +147,13 @@ async def evaluation_cmd_t(_, m):
out_file.write(final_output) out_file.write(final_output)
await m.reply_document( await m.reply_document(
document="MissKatyEval.txt", document="MissKatyEval.txt",
caption=f"<code>{cmd[: 4096 // 4 - 1]}</code>", caption=f"<code>{cmd[1][: 4096 // 4 - 1]}</code>",
disable_notification=True, disable_notification=True,
thumb="img/thumb.jpg", thumb="img/thumb.jpg",
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]), reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="❌ Close", callback_data=f"close#{m.from_user.id}")]]),
) )
os.remove("MissKatyEval.txt") os.remove("MissKatyEval.txt")
await m.delete if m.from_user.is_self else await status_message.delete() await m.delete() if m.from_user.is_self else await status_message.delete()
else: else:
await edit_or_reply( await edit_or_reply(
m, m,