Skip to content

Commit 7f1478e

Browse files
authored
1.9.8
1 parent 478b52d commit 7f1478e

11 files changed

Lines changed: 65 additions & 12 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ RUN pip install --upgrade pip && \
2020

2121
COPY . .
2222

23-
CMD ["python", "-m", "Thunder"]
23+
CMD ["bash", "thunder.sh"]

Thunder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
import time
44

55
StartTime = time.time()
6-
__version__ = "1.9.7"
6+
__version__ = "1.9.8"

Thunder/__main__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
import sys
77
from datetime import datetime
88

9+
from uvloop import install
910
from pathlib import Path
1011

11-
import uvloop
12-
uvloop.install()
13-
asyncio.set_event_loop(asyncio.new_event_loop())
14-
12+
install()
1513
from aiohttp import web
1614
from pyrogram import idle
1715

@@ -252,11 +250,14 @@ async def schedule_token_cleanup():
252250
logger.error(f"Token cleanup error: {e}", exc_info=True)
253251

254252
if __name__ == '__main__':
253+
loop = asyncio.get_event_loop()
255254
try:
256-
asyncio.run(start_services())
255+
loop.run_until_complete(start_services())
257256
except KeyboardInterrupt:
258257
print("╔═══════════════════════════════════════════════════════════╗")
259258
print("║ Bot stopped by user (CTRL+C) ║")
260259
print("╚═══════════════════════════════════════════════════════════╝")
261260
except Exception as e:
262261
logger.error(f"An unexpected error occurred: {e}")
262+
finally:
263+
loop.close()

Thunder/bot/plugins/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async def show_stats(client: Client, message: Message):
143143
async def restart_bot(client: Client, message: Message):
144144
msg = await reply(message, text=MSG_RESTARTING)
145145
await db.add_restart_message(msg.id, message.chat.id)
146-
os.execv(sys.executable, [sys.executable, "-m", "Thunder"])
146+
os.execv("/bin/bash", ["bash", "thunder.sh"])
147147

148148

149149
@StreamBot.on_message(filters.command("log") & owner_filter)

Thunder/bot/plugins/stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async def process_single(
325325
)
326326
elif not original_request_msg:
327327
await send_link(msg, links)
328-
if msg.chat.type != enums.ChatType.PRIVATE and msg.from_user:
328+
if msg.chat.type != enums.ChatType.PRIVATE and msg.from_user and not original_request_msg:
329329
await send_dm_links(bot, msg.from_user.id, links, msg.chat.title or "the chat")
330330
source_msg = original_request_msg if original_request_msg else msg
331331
source_info = ""

Thunder/utils/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_commands():
1818
"ban": "(Admin) Ban a user",
1919
"unban": "(Admin) Unban a user",
2020
"log": "(Admin) Send bot logs",
21-
"restart": "(Admin) Restart the bot",
21+
"restart": "(Admin) Update and restart the bot",
2222
"shell": "(Admin) Execute a shell command",
2323
"speedtest": "(Admin) Run network speed test",
2424
"users": "(Admin) Show the total number of users",

Thunder/utils/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112
MSG_WORKLOAD_ITEM = " {bot_name}: {load}\n"
113113
MSG_ADMIN_RESTART_DONE = "✅ **Restart Successful!**"
114-
MSG_RESTARTING = "♻️ **Restarting Bot...**\n\n> ⏳ Please wait a moment."
114+
MSG_RESTARTING = "♻️ **Updating and Restarting Bot...**\n\n> ⏳ Please wait a moment."
115115
MSG_LOG_FILE_CAPTION = "📄 **System Logs**"
116116

117117
MSG_LOG_FILE_EMPTY = "ℹ️ **Log File Empty:** No data found in the log file."

config_sample.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ RATE_LIMIT_PERIOD_MINUTES=1
9999
# Maximum number of requests that can be queued.
100100
MAX_QUEUE_SIZE=100
101101

102+
####################
103+
## UPDATE SETTINGS
104+
####################
105+
106+
# Git repository for updates
107+
UPSTREAM_REPO="https://github.com/fyaz05/FileToLink"
108+
109+
# Branch to update from
110+
UPSTREAM_BRANCH="main" # Default branch for updates
111+
102112
####################
103113
## ADVANCED SETTINGS (modify with caution)
104114
####################

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ psutil
77
python-dotenv
88
speedtest-cli
99
tgcrypto
10-
uvloop
10+
uvloop==0.21.0

thunder.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python3 update.py && python3 -m Thunder

0 commit comments

Comments
 (0)