diff --git a/driver/decorators.py b/driver/decorators.py index 7e548a5..e0d94cd 100644 --- a/driver/decorators.py +++ b/driver/decorators.py @@ -1,3 +1,4 @@ +import traceback from typing import Callable from pyrogram import Client from pyrogram.types import Message @@ -19,6 +20,7 @@ def errors(func: Callable) -> Callable: try: return await func(client, message) except Exception as e: + traceback.print_exc() await message.reply(f"{type(e).__name__}: {e}") return decorator diff --git a/program/admins.py b/program/admins.py index 9461136..036fda9 100644 --- a/program/admins.py +++ b/program/admins.py @@ -1,4 +1,6 @@ import os +import traceback + from cache.admins import admins from driver.core import calls, bot from pyrogram import Client, filters @@ -71,6 +73,7 @@ async def stop(client, m: Message): clear_queue(chat_id) await m.reply("โœ… The userbot has disconnected from the video chat.") except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing is streaming**") @@ -97,6 +100,7 @@ async def pause(client, m: Message): "โธ **Track paused.**\n\nโ€ข **To resume the stream, use the**\nยป /resume command." ) except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing is streaming**") @@ -123,6 +127,7 @@ async def resume(client, m: Message): "โ–ถ๏ธ **Track resumed.**\n\nโ€ข **To pause the stream, use the**\nยป /pause command." ) except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing is streaming**") @@ -201,6 +206,7 @@ async def mute(client, m: Message): "๐Ÿ”‡ **Userbot muted.**\n\nโ€ข **To unmute the userbot, use the**\nยป /unmute command." ) except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing is streaming**") @@ -227,6 +233,7 @@ async def unmute(client, m: Message): "๐Ÿ”Š **Userbot unmuted.**\n\nโ€ข **To mute the userbot, use the**\nยป /mute command." ) except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing is streaming**") @@ -251,6 +258,7 @@ async def cbpause(_, query: CallbackQuery): await music_off(chat_id) await query.answer("โธ The music has paused !\n\nยป to resume the music click on resume button !", show_alert=True) except Exception as e: + traceback.print_exc() await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=close_mark) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @@ -275,6 +283,7 @@ async def cbresume(_, query: CallbackQuery): await music_on(chat_id) await query.answer("โ–ถ๏ธ The music has resumed !\n\nยป to pause the music click on pause button !", show_alert=True) except Exception as e: + traceback.print_exc() await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=close_mark) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @@ -297,6 +306,7 @@ async def cbstop(_, query: CallbackQuery): clear_queue(chat_id) await query.edit_message_text("โœ… **this streaming has ended**", reply_markup=close_mark) except Exception as e: + traceback.print_exc() await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=close_mark) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @@ -321,6 +331,7 @@ async def cbmute(_, query: CallbackQuery): await music_off(chat_id) await query.answer("๐Ÿ”‡ The stream userbot has muted !\n\nยป to unmute the userbot click on unmute button !", show_alert=True) except Exception as e: + traceback.print_exc() await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=close_mark) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @@ -345,6 +356,7 @@ async def cbunmute(_, query: CallbackQuery): await music_on(chat_id) await query.answer("๐Ÿ”Š The stream userbot has unmuted !\n\nยป to mute the userbot click on mute button !", show_alert=True) except Exception as e: + traceback.print_exc() await query.edit_message_text(f"๐Ÿšซ **error:**\n\n`{e}`", reply_markup=close_mark) else: await query.answer("โŒ nothing is currently streaming", show_alert=True) @@ -371,6 +383,7 @@ async def change_volume(client, m: Message): f"โœ… **volume set to** `{range}`%" ) except Exception as e: + traceback.print_exc() await m.reply(f"๐Ÿšซ **error:**\n\n`{e}`") else: await m.reply("โŒ **nothing in streaming**") diff --git a/program/downloader.py b/program/downloader.py index 59effd4..c0eadd2 100644 --- a/program/downloader.py +++ b/program/downloader.py @@ -4,6 +4,8 @@ import os import re import time import asyncio +import traceback + import lyricsgenius import aiofiles @@ -126,6 +128,7 @@ async def video_downloader(_, message): ytdl_data = ytdl.extract_info(link, download=True) file_name = ytdl.prepare_filename(ytdl_data) except Exception as e: + traceback.print_exc() return await msg.edit(f"๐Ÿšซ error: `{e}`") preview = wget.download(thumbnail) await msg.edit("๐Ÿ“ค uploading video...") diff --git a/program/extra.py b/program/extra.py index 33cea8a..68884f1 100644 --- a/program/extra.py +++ b/program/extra.py @@ -2,6 +2,7 @@ import asyncio +import traceback from pyrogram.types import Message from pyrogram import Client, filters, __version__ as pyrover @@ -159,6 +160,7 @@ async def active_calls(c: Client, message: Message): for chat in chats: served_chats.append(int(chat["chat_id"])) except Exception as e: + traceback.print_exc() await message.reply_text(f"๐Ÿšซ error: `{e}`") text = "" j = 0 diff --git a/program/music.py b/program/music.py index a1bf67d..0d0fa6d 100644 --- a/program/music.py +++ b/program/music.py @@ -4,6 +4,8 @@ import os # pyrogram stuff +import traceback + from pyrogram import Client from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardMarkup, Message @@ -81,6 +83,7 @@ async def play(c: Client, m: Message): try: aing = await c.get_me() except Exception as e: + traceback.print_exc() return await m.reply_text(f"error:\n\n{e}") a = await c.get_chat_member(chat_id, aing.id) if a.status != "administrator": @@ -136,6 +139,7 @@ async def play(c: Client, m: Message): except UserAlreadyParticipant: pass except Exception as e: + traceback.print_exc() return await m.reply_text( f"โŒ **userbot failed to join**\n\n**reason**: `{e}`" ) @@ -208,6 +212,7 @@ async def play(c: Client, m: Message): except Exception as e: await suhu.delete() await remove_active_chat(chat_id) + traceback.print_exc() await m.reply_text(f"๐Ÿšซ error:\n\nยป {e}") else: if len(m.command) < 2: diff --git a/program/video.py b/program/video.py index bd74111..bc0b568 100644 --- a/program/video.py +++ b/program/video.py @@ -6,6 +6,7 @@ import os import re import asyncio +import traceback # repository stuff from config import BOT_USERNAME, IMG_1, IMG_2, IMG_5 from program.utils.inline import stream_markup @@ -96,6 +97,7 @@ async def vplay(c: Client, m: Message): try: aing = await c.get_me() except Exception as e: + traceback.print_exc() return await m.reply_text(f"error:\n\n{e}") a = await c.get_chat_member(chat_id, aing.id) if a.status != "administrator": @@ -151,6 +153,7 @@ async def vplay(c: Client, m: Message): except UserAlreadyParticipant: pass except Exception as e: + traceback.print_exc() return await m.reply_text( f"โŒ **userbot failed to join**\n\n**reason**: `{e}`" ) @@ -398,6 +401,7 @@ async def vstream(c: Client, m: Message): try: aing = await c.get_me() except Exception as e: + traceback.print_exc() return await m.reply_text(f"error:\n\n{e}") a = await c.get_chat_member(chat_id, aing.id) if a.status != "administrator": @@ -453,6 +457,7 @@ async def vstream(c: Client, m: Message): except UserAlreadyParticipant: pass except Exception as e: + traceback.print_exc() return await m.reply_text( f"โŒ **userbot failed to join**\n\n**reason**: `{e}`" )