From fd0c4c05452db7f9af1e62de907c462747e12fed Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 30 Jun 2023 11:33:34 +0200 Subject: [PATCH 1/3] Bump libbot to 1.7 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9b5c13f..bee2675 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,5 +11,5 @@ pytimeparse~=1.1.8 tgcrypto==1.2.5 uvloop==0.17.0 --extra-index-url https://git.end-play.xyz/api/packages/profitroll/pypi/simple -libbot[speed,pyrogram]==1.5 +libbot[speed,pyrogram]==1.7 photosapi_client==0.5.0 \ No newline at end of file From bfec702bef0d54c20759dcc6f7f1bf3450bbab38 Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 30 Jun 2023 11:34:06 +0200 Subject: [PATCH 2/3] Config cleanup --- classes/pyroclient.py | 11 +++-------- config_example.json | 7 +------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/classes/pyroclient.py b/classes/pyroclient.py index 205df61..52dd38a 100644 --- a/classes/pyroclient.py +++ b/classes/pyroclient.py @@ -11,9 +11,11 @@ from typing import Dict, List, Tuple, Union import aiofiles from aiohttp import ClientSession +from apscheduler.schedulers.asyncio import AsyncIOScheduler from bson import ObjectId from libbot import json_write from libbot.i18n.sync import _ +from libbot.pyrogram.classes import PyroClient from photosapi_client.errors import UnexpectedStatus from pyrogram.errors import bad_request_400 from pyrogram.types import Message, User @@ -44,16 +46,9 @@ from modules.sender import send_content logger = logging.getLogger(__name__) -from datetime import datetime -from typing import List, Union - -from apscheduler.schedulers.asyncio import AsyncIOScheduler -from libbot.pyrogram.classes import PyroClient - - class PyroClient(PyroClient): def __init__(self, scheduler: AsyncIOScheduler): - super().__init__(scheduler=scheduler) + super().__init__(locales_root=Path("locale"), scheduler=scheduler) self.version: float = 0.2 diff --git a/config_example.json b/config_example.json index dea8d3a..186f3c9 100644 --- a/config_example.json +++ b/config_example.json @@ -1,7 +1,6 @@ { "locale": "en", "locale_log": "en", - "locale_fallback": "en", "bot": { "owner": 0, "admins": [], @@ -37,11 +36,7 @@ "locations": { "tmp": "tmp", "data": "data", - "cache": "cache", - "sent": "data/sent", - "queue": "data/queue", - "index": "data/index.json", - "locale": "locale" + "cache": "cache" }, "disabled_plugins": [], "posting": { From 28b5449f2ac7ffe45e6d7fcda090c573def280ee Mon Sep 17 00:00:00 2001 From: profitroll Date: Fri, 30 Jun 2023 11:34:15 +0200 Subject: [PATCH 3/3] Improved /shutdown --- plugins/commands/general.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/commands/general.py b/plugins/commands/general.py index 18a0357..a33182a 100644 --- a/plugins/commands/general.py +++ b/plugins/commands/general.py @@ -1,3 +1,4 @@ +import asyncio from os import makedirs from pathlib import Path from time import time @@ -44,4 +45,4 @@ async def cmd_kill(app: PyroClient, msg: Message): Path(f"{app.config['locations']['cache']}/shutdown_time"), ) - exit() + asyncio.get_event_loop().create_task(app.stop())