Moved handlers to another location

This commit is contained in:
Profitroll 2023-02-14 11:38:54 +01:00
parent b589da5d8f
commit 08e03ba911
6 changed files with 52 additions and 14 deletions

View File

@ -1,4 +1,4 @@
from app import app
from modules.app import app
from pyrogram import filters
from pyrogram.types import CallbackQuery
from pyrogram.client import Client

View File

@ -1,12 +1,15 @@
from os import sep
from pathlib import Path
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
InlineKeyboardMarkup)
from modules.api_client import upload_pic
from modules.utils import jsonLoad, jsonSave, configGet, locale
from modules.submissions import subBlock, subUnblock
from modules.app import app
from modules.submissions import subBlock, subUnblock
from modules.utils import configGet, jsonLoad, jsonSave, locale
@app.on_callback_query(filters.regex("sub_yes_[\s\S]*_[\s\S]*"))

View File

@ -1,11 +1,14 @@
from os import getpid
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import Message
from modules.app import app
from modules.logger import logWrite
from modules.utils import configGet, killProc, locale
@app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"]))
async def cmd_kill(app: Client, msg: Message):

View File

@ -1,8 +1,10 @@
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import Message
from modules.app import app
from modules.utils import jsonLoad, configGet, locale
from modules.utils import configGet, jsonLoad, locale
@app.on_message(~ filters.scheduled & filters.command(["start"], prefixes="/"))
async def cmd_start(app: Client, msg: Message):

View File

@ -1,10 +1,12 @@
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
from modules.utils import jsonLoad, configGet, locale
from modules.logger import logWrite
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from modules.app import app
from modules.submissions import subLimited, subLimit
from modules.logger import logWrite
from modules.submissions import subLimit, subLimited
from modules.utils import configGet, jsonLoad, locale
@app.on_message(~ filters.scheduled & filters.photo | filters.video | filters.animation | filters.document)
async def get_submission(_: Client, msg: Message):

View File

@ -116,13 +116,12 @@ pid = getpid()
# Imports ==================================================================================================================================
from modules.commands.general import *
from modules.commands_register import register_commands
from plugins.commands.general import *
if configGet("submit", "mode"):
from modules.callbacks.submission import *
from modules.commands.mode_submit import *
from modules.handlers.submission import *
from plugins.callbacks.submission import *
from plugins.commands.mode_submit import *
from plugins.handlers.submission import *
if configGet("api_based", "mode"):
from modules.api_client import authorize
@ -139,6 +138,35 @@ if configGet("api_based", "mode"):
# # else:
# # logWrite(f"Got raw update of type {type(update)} with contents {update}", debug=True)
# async def main():
# await app.start()
# logWrite(locale("startup", "console", locale=configGet("locale")).format(str(pid)))
# if configGet("startup", "reports"):
# await app.send_message(configGet("admin"), locale("startup", "message", locale=configGet("locale")).format(str(pid)))
# if configGet("post", "mode"):
# scheduler.start()
# if configGet("api_based", "mode"):
# token = authorize()
# if len(get(f'{configGet("address", "posting", "api")}/albums?q={configGet("queue", "posting", "api", "albums")}', headers={"Authorization": f"Bearer {token}"}).json()["results"]) == 0:
# post(f'{configGet("address", "posting", "api")}/albums?name={configGet("queue", "posting", "api", "albums")}&title={configGet("queue", "posting", "api", "albums")}', headers={"Authorization": f"Bearer {token}"})
# await idle()
# await app.send_message(configGet("admin"), locale("shutdown", "message", locale=configGet("locale")).format(str(pid)))
# logWrite(locale("shutdown", "console", locale=configGet("locale")).format(str(pid)))
# killProc(pid)
# if __name__ == "__main__":
# if find_spec("uvloop") is not None:
# uvloop.install()
# asyncio.run(main())
if __name__ == "__main__":
logWrite(locale("startup", "console", locale=configGet("locale")).format(str(pid)))