d4rktg 0.5.1__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {d4rktg-0.5.1 → d4rktg-0.5.2}/PKG-INFO +1 -1
- d4rktg-0.5.2/VERSION.txt +1 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Handlers/_bot.py +23 -7
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rktg.egg-info/PKG-INFO +1 -1
- d4rktg-0.5.1/VERSION.txt +0 -1
- {d4rktg-0.5.1 → d4rktg-0.5.2}/MANIFEST.in +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/README.rst +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Database/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Database/db.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Handlers/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Handlers/_scheduler.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Logs/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Logs/_logger.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Models/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Models/_commands.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Models/_movie_title.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_decorators.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_delete.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_fonts.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_ip.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_movie_parser.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_ractions.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_round.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/Utils/_terminal.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rk/__init__.py +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rktg.egg-info/SOURCES.txt +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rktg.egg-info/dependency_links.txt +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rktg.egg-info/requires.txt +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/d4rktg.egg-info/top_level.txt +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/requirements.txt +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/setup.cfg +0 -0
- {d4rktg-0.5.1 → d4rktg-0.5.2}/setup.py +0 -0
d4rktg-0.5.2/VERSION.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.5.2
|
@@ -12,6 +12,9 @@ from pyrogram.errors.exceptions.bad_request_400 import AccessTokenExpired
|
|
12
12
|
|
13
13
|
from d4rk.Logs import setup_logger
|
14
14
|
|
15
|
+
logs_sent = False
|
16
|
+
logs_lock = asyncio.Lock()
|
17
|
+
|
15
18
|
logger = setup_logger(__name__)
|
16
19
|
|
17
20
|
class BotManager(Client):
|
@@ -98,22 +101,35 @@ class BotManager(Client):
|
|
98
101
|
await self.setup_webserver()
|
99
102
|
|
100
103
|
async def powerdown(self, *args):
|
104
|
+
global logs_sent, logs_lock
|
101
105
|
logger.info("Initiating APP to stop...")
|
102
106
|
if self._rename:await super().set_bot_info(lang_code='en',name=self.app_name + " (Offline)")
|
103
107
|
self.stop_scheduler()
|
104
108
|
today = self.TZ_now.strftime("%Y-%m-%d")
|
105
109
|
if hasattr(self, '_web_runner') and self._web_runner:
|
106
110
|
await self.web_server.cleanup()
|
107
|
-
|
108
|
-
|
111
|
+
|
112
|
+
logger.info("Stopping bot client...")
|
113
|
+
if self._is_connected and self.LOGS:
|
109
114
|
try:
|
110
|
-
|
111
|
-
|
115
|
+
await self.send_message(chat_id=self.LOGS, text=f"{self._bot_info.mention} stopping...")
|
116
|
+
except Exception as e:
|
117
|
+
logger.error(f"Error sending stop message for {self._bot_info.first_name}: {e}")
|
118
|
+
|
119
|
+
async with logs_lock:
|
120
|
+
if not logs_sent and self._is_connected:
|
121
|
+
logs_sent = True
|
122
|
+
try:
|
112
123
|
await self.send_document(chat_id=self.LOGS, document=f"logs/log-{today}.txt")
|
113
|
-
|
124
|
+
logger.info("Log document sent successfully")
|
125
|
+
except Exception as e:
|
126
|
+
logger.error(f"Error sending log document: {e}")
|
127
|
+
|
128
|
+
if self._is_connected and self.LOGS:
|
129
|
+
try:
|
130
|
+
await self.send_message(chat_id=self.LOGS, text=f"{self._bot_info.mention} stopped successfully!")
|
114
131
|
except Exception as e:
|
115
|
-
logger.error(f"Error sending stop
|
116
|
-
logger.info(f"{self._bot_info.first_name} - @{self._bot_info.username} Stoped")
|
132
|
+
logger.error(f"Error sending stop confirmation for {self._bot_info.first_name}: {e}")
|
117
133
|
await super().stop()
|
118
134
|
sys.exit(0)
|
119
135
|
|
d4rktg-0.5.1/VERSION.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.1
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|