|
@@ -30,7 +30,7 @@ from pyrogram import filters, idle
|
|
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|
|
|
|
|
|
|
from wbb import (BOT_NAME, BOT_USERNAME, LOG_GROUP_ID, USERBOT_NAME,
|
|
from wbb import (BOT_NAME, BOT_USERNAME, LOG_GROUP_ID, USERBOT_NAME,
|
|
|
- aiohttpsession, app)
|
|
|
|
|
|
|
+ aiohttpsession, app, log)
|
|
|
from wbb.modules import ALL_MODULES
|
|
from wbb.modules import ALL_MODULES
|
|
|
from wbb.modules.sudoers import bot_sys_stats
|
|
from wbb.modules.sudoers import bot_sys_stats
|
|
|
from wbb.utils import paginate_modules
|
|
from wbb.utils import paginate_modules
|
|
@@ -48,13 +48,13 @@ async def start_bot():
|
|
|
for module in ALL_MODULES:
|
|
for module in ALL_MODULES:
|
|
|
imported_module = importlib.import_module("wbb.modules." + module)
|
|
imported_module = importlib.import_module("wbb.modules." + module)
|
|
|
if (
|
|
if (
|
|
|
- hasattr(imported_module, "__MODULE__")
|
|
|
|
|
- and imported_module.__MODULE__
|
|
|
|
|
|
|
+ hasattr(imported_module, "__MODULE__")
|
|
|
|
|
+ and imported_module.__MODULE__
|
|
|
):
|
|
):
|
|
|
imported_module.__MODULE__ = imported_module.__MODULE__
|
|
imported_module.__MODULE__ = imported_module.__MODULE__
|
|
|
if (
|
|
if (
|
|
|
- hasattr(imported_module, "__HELP__")
|
|
|
|
|
- and imported_module.__HELP__
|
|
|
|
|
|
|
+ hasattr(imported_module, "__HELP__")
|
|
|
|
|
+ and imported_module.__HELP__
|
|
|
):
|
|
):
|
|
|
HELPABLE[
|
|
HELPABLE[
|
|
|
imported_module.__MODULE__.replace(" ", "_").lower()
|
|
imported_module.__MODULE__.replace(" ", "_").lower()
|
|
@@ -73,13 +73,13 @@ async def start_bot():
|
|
|
print("+===============+===============+===============+===============+")
|
|
print("+===============+===============+===============+===============+")
|
|
|
print(bot_modules)
|
|
print(bot_modules)
|
|
|
print("+===============+===============+===============+===============+")
|
|
print("+===============+===============+===============+===============+")
|
|
|
- print(f"[INFO]: BOT STARTED AS {BOT_NAME}!")
|
|
|
|
|
- print(f"[INFO]: USERBOT STARTED AS {USERBOT_NAME}!")
|
|
|
|
|
|
|
+ log.info(f"BOT STARTED AS {BOT_NAME}!")
|
|
|
|
|
+ log.info(f"USERBOT STARTED AS {USERBOT_NAME}!")
|
|
|
|
|
|
|
|
restart_data = await clean_restart_stage()
|
|
restart_data = await clean_restart_stage()
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
- print("[INFO]: SENDING ONLINE STATUS")
|
|
|
|
|
|
|
+ log.info("Sending online status")
|
|
|
if restart_data:
|
|
if restart_data:
|
|
|
await app.edit_message_text(
|
|
await app.edit_message_text(
|
|
|
restart_data["chat_id"],
|
|
restart_data["chat_id"],
|
|
@@ -95,12 +95,12 @@ async def start_bot():
|
|
|
await idle()
|
|
await idle()
|
|
|
|
|
|
|
|
await aiohttpsession.close()
|
|
await aiohttpsession.close()
|
|
|
- print("[INFO]: CLOSING AIOHTTP SESSION AND STOPPING BOT")
|
|
|
|
|
|
|
+ log.info("Stopping clients")
|
|
|
await app.stop()
|
|
await app.stop()
|
|
|
- print("[INFO]: Bye!")
|
|
|
|
|
|
|
+ log.info("Cancelling asyncio tasks")
|
|
|
for task in asyncio.all_tasks():
|
|
for task in asyncio.all_tasks():
|
|
|
task.cancel()
|
|
task.cancel()
|
|
|
- print("[INFO]: Turned off!")
|
|
|
|
|
|
|
+ log.info("Dead!")
|
|
|
|
|
|
|
|
|
|
|
|
|
home_keyboard_pm = InlineKeyboardMarkup(
|
|
home_keyboard_pm = InlineKeyboardMarkup(
|
|
@@ -133,12 +133,11 @@ home_keyboard_pm = InlineKeyboardMarkup(
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
home_text_pm = (
|
|
home_text_pm = (
|
|
|
- f"Hey there! My name is {BOT_NAME}. I can manage your "
|
|
|
|
|
- + "group with lots of useful features, feel free to "
|
|
|
|
|
- + "add me to your group."
|
|
|
|
|
|
|
+ f"Hey there! My name is {BOT_NAME}. I can manage your "
|
|
|
|
|
+ + "group with lots of useful features, feel free to "
|
|
|
|
|
+ + "add me to your group."
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
keyboard = InlineKeyboardMarkup(
|
|
keyboard = InlineKeyboardMarkup(
|
|
|
[
|
|
[
|
|
|
[
|
|
[
|
|
@@ -177,8 +176,8 @@ async def start(_, message):
|
|
|
elif "_" in name:
|
|
elif "_" in name:
|
|
|
module = name.split("_", 1)[1]
|
|
module = name.split("_", 1)[1]
|
|
|
text = (
|
|
text = (
|
|
|
- f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n"
|
|
|
|
|
- + HELPABLE[module].__HELP__
|
|
|
|
|
|
|
+ f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n"
|
|
|
|
|
+ + HELPABLE[module].__HELP__
|
|
|
)
|
|
)
|
|
|
await message.reply(text, disable_web_page_preview=True)
|
|
await message.reply(text, disable_web_page_preview=True)
|
|
|
elif name == "help":
|
|
elif name == "help":
|
|
@@ -228,8 +227,8 @@ async def help_command(_, message):
|
|
|
name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
|
|
name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
|
|
|
if str(name) in HELPABLE:
|
|
if str(name) in HELPABLE:
|
|
|
text = (
|
|
text = (
|
|
|
- f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n"
|
|
|
|
|
- + HELPABLE[name].__HELP__
|
|
|
|
|
|
|
+ f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n"
|
|
|
|
|
+ + HELPABLE[name].__HELP__
|
|
|
)
|
|
)
|
|
|
await message.reply(text, disable_web_page_preview=True)
|
|
await message.reply(text, disable_web_page_preview=True)
|
|
|
else:
|
|
else:
|
|
@@ -306,10 +305,10 @@ General command are:
|
|
|
if mod_match:
|
|
if mod_match:
|
|
|
module = (mod_match.group(1)).replace(" ", "_")
|
|
module = (mod_match.group(1)).replace(" ", "_")
|
|
|
text = (
|
|
text = (
|
|
|
- "{} **{}**:\n".format(
|
|
|
|
|
- "Here is the help for", HELPABLE[module].__MODULE__
|
|
|
|
|
- )
|
|
|
|
|
- + HELPABLE[module].__HELP__
|
|
|
|
|
|
|
+ "{} **{}**:\n".format(
|
|
|
|
|
+ "Here is the help for", HELPABLE[module].__MODULE__
|
|
|
|
|
+ )
|
|
|
|
|
+ + HELPABLE[module].__HELP__
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
await query.message.edit(
|
|
await query.message.edit(
|