From f6a2ba627de623a0fc3577b86164131f1232ae2f Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:16:07 +0700 Subject: [PATCH 01/31] copyright header --- program/admins.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/program/admins.py b/program/admins.py index b039d0f..55d614c 100644 --- a/program/admins.py +++ b/program/admins.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + import traceback from cache.admins import admins From c62cee85fe89e17e118183f7da914742d4f8e6ba Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:17:00 +0700 Subject: [PATCH 02/31] copyright header --- program/blockchat.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/program/blockchat.py b/program/blockchat.py index cc9bc30..d536216 100644 --- a/program/blockchat.py +++ b/program/blockchat.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + from pyrogram.types import Message from pyrogram import Client, filters From 545b7e0372eefcb87f7e6fe21739f8b10951a394 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:18:32 +0700 Subject: [PATCH 03/31] copyright header --- program/callback.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/program/callback.py b/program/callback.py index d9d560f..2777001 100644 --- a/program/callback.py +++ b/program/callback.py @@ -1,10 +1,28 @@ -# Copyright (C) 2021 By VeezMusicProject +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + from driver.core import me_bot -from driver.decorators import check_blacklist from driver.queues import QUEUE -from pyrogram import Client, filters +from driver.decorators import check_blacklist from program.utils.inline import menu_markup, stream_markup + +from pyrogram import Client, filters from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup from config import ( From 1fc495a5a124b92501366370ff5c0ad0740a8700 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:20:52 +0700 Subject: [PATCH 04/31] copyright header --- program/developer.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/program/developer.py b/program/developer.py index cd5f929..f3ec21d 100644 --- a/program/developer.py +++ b/program/developer.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + import re import sys import subprocess @@ -10,10 +29,11 @@ from inspect import getfullargspec from config import BOT_USERNAME as bname from driver.core import bot from driver.filters import command -from pyrogram import Client, filters from driver.database.dbchat import remove_served_chat from driver.decorators import bot_creator, sudo_users_only, errors from driver.utils import remove_if_exists + +from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup @@ -174,7 +194,7 @@ async def shellrunner(client, message): async def bot_leave_group(_, message): if len(message.command) != 2: await message.reply_text( - "**usage:**\n\nĀ» /leavebot [chat id]" + "**usage:**\n\nĀ» /leavebot (`chat_id`)" ) return chat = message.text.split(None, 2)[1] From 4a6724aeac7513a1fe736d19cb02319794171de4 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:26:40 +0700 Subject: [PATCH 05/31] copyright header --- program/downloader.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/program/downloader.py b/program/downloader.py index ea2b495..ea89b69 100644 --- a/program/downloader.py +++ b/program/downloader.py @@ -1,4 +1,21 @@ -# Copyright (C) 2021 By Veez Music-Project +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + import wget import yt_dlp @@ -89,8 +106,6 @@ async def video_downloader(_, message): await message.delete() ydl_opts = { "format": "best", - "keepvideo": True, - "prefer-ffmpeg": False, "geo-bypass": True, "noprogress": True, "user-agent": "Mozilla/5.0 (Linux; Android 7.0; k960n_mt6580_32_n) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36", @@ -144,17 +159,18 @@ async def get_lyric_genius(_, message: Message): return await message.reply_text("**usage:**\n\n/lyrics (song name)") m = await message.reply_text("šŸ” Searching lyrics...") query = message.text.split(None, 1)[1] - x = "OXaVabSRKQLqwpiYOn-E4Y7k3wj-TNdL5RfDPXlnXhCErbcqVvdCF-WnMR5TBctI" - y = lyricsgenius.Genius(x) - y.verbose = False - S = y.search_song(query, get_full_info=False) - if S is None: + api = "OXaVabSRKQLqwpiYOn-E4Y7k3wj-TNdL5RfDPXlnXhCErbcqVvdCF-WnMR5TBctI" + data = lyricsgenius.Genius(api) + data.verbose = False + result = data.search_song(query, get_full_info=False) + if result is None: return await m.edit("āŒ `404` lyrics not found") xxx = f""" -**Song Name:** __{query}__ -**Artist Name:** {S.artist} -**__Lyrics:__** -{S.lyrics}""" +**Title song:** {query} +**Artist name:** {result.artist} +**Lyrics:** + +{result.lyrics}""" if len(xxx) > 4096: await m.delete() filename = "lyrics.txt" From bbae750a14686d1c5c68789d5e5bb5f8dd3194fc Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:30:19 +0700 Subject: [PATCH 06/31] copyright header --- program/{extra.py => essentials.py} | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) rename program/{extra.py => essentials.py} (88%) diff --git a/program/extra.py b/program/essentials.py similarity index 88% rename from program/extra.py rename to program/essentials.py index c491f08..2463129 100644 --- a/program/extra.py +++ b/program/essentials.py @@ -1,4 +1,20 @@ -""" broadcast & statistic collector """ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" import asyncio @@ -6,13 +22,12 @@ import traceback from pyrogram.types import Message from pyrogram import Client, filters, __version__ as pyrover - from pytgcalls import (__version__ as pytgver) -from driver.core import me_bot from program import __version__ as ver from program.start import __python_version__ as pyver +from driver.core import me_bot from driver.filters import command from driver.decorators import bot_creator, sudo_users_only from driver.database.dbchat import get_served_chats From 766612c4dee5d09d558671923f53d32dbbec0d3a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:31:08 +0700 Subject: [PATCH 07/31] copyright header --- program/inline.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/program/inline.py b/program/inline.py index 1930020..33116a5 100644 --- a/program/inline.py +++ b/program/inline.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + from pyrogram import Client, errors from pyrogram.types import ( InlineQuery, From 1c39b1506f2bec623d241a3b4adc8d737b89903e Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:32:42 +0700 Subject: [PATCH 08/31] copyright header --- program/{music.py => music_stream.py} | 28 ++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) rename program/{music.py => music_stream.py} (95%) diff --git a/program/music.py b/program/music_stream.py similarity index 95% rename from program/music.py rename to program/music_stream.py index a012a75..6d96252 100644 --- a/program/music.py +++ b/program/music_stream.py @@ -1,19 +1,33 @@ -# Copyright (C) 2021 By Veez Music-Project -# Commit Start Date 20/10/2021 -# Finished On 28/10/2021 +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + -# pyrogram stuff import traceback from pyrogram import Client from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardMarkup, Message -# pytgcalls stuff + from pytgcalls import idle from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioPiped from pytgcalls.types.input_stream.quality import HighQualityAudio -# repository stuff + from driver.decorators import require_admin, check_blacklist from program.utils.inline import stream_markup from driver.design.thumbnail import thumb @@ -24,7 +38,7 @@ from driver.core import calls, user, me_user from driver.utils import bash, remove_if_exists, from_tg_get_msg from driver.database.dbqueue import add_active_chat, remove_active_chat, music_on from config import BOT_USERNAME, IMG_5 -# youtube-dl stuff + from youtubesearchpython import VideosSearch From f22cd78c6df56615fbca849fe0b5a6bccac0dade Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:33:53 +0700 Subject: [PATCH 09/31] copyright header --- program/playlist.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/program/playlist.py b/program/playlist.py index 227440b..e34e2e7 100644 --- a/program/playlist.py +++ b/program/playlist.py @@ -1,14 +1,30 @@ -# Copyright (C) 2021 By Veez Music-Project -# Commit Start Date 20/10/2021 -# Finished On 28/10/2021 +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + from config import BOT_USERNAME + +from pyrogram import Client from pyrogram.types import ( InlineKeyboardButton, InlineKeyboardMarkup, Message, ) -from pyrogram import Client from driver.decorators import check_blacklist from driver.queues import QUEUE, get_queue From f78a2246b34e0129e02b3663e4606f318af1004a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:35:10 +0700 Subject: [PATCH 10/31] copyright header --- program/punishment.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/program/punishment.py b/program/punishment.py index 8494a09..05aa236 100644 --- a/program/punishment.py +++ b/program/punishment.py @@ -1,4 +1,20 @@ -""" global banned and un-global banned module """ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" import asyncio @@ -6,6 +22,7 @@ import asyncio from pyrogram import Client from pyrogram.types import Message from pyrogram.errors import FloodWait + from driver.core import me_bot from driver.filters import command, other_filters from driver.decorators import bot_creator From 91b238a2c93edb499960c24e2a60a587ba5fec94 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:37:00 +0700 Subject: [PATCH 11/31] copyright header --- program/speedtest.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/program/speedtest.py b/program/speedtest.py index 182b3e5..2cfba34 100644 --- a/program/speedtest.py +++ b/program/speedtest.py @@ -1,14 +1,33 @@ -# credit to TeamYukki for this speedtest module +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + import wget import speedtest from PIL import Image +from config import BOT_USERNAME as bname + from driver.filters import command from driver.decorators import sudo_users_only -from config import BOT_USERNAME as bname from driver.core import bot as app from driver.utils import remove_if_exists + from pyrogram import Client, filters from pyrogram.types import Message From 85e1f7a07f4b1d841b045caa930255013ff94732 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:38:22 +0700 Subject: [PATCH 12/31] copyright header --- program/start.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/program/start.py b/program/start.py index 9cdcedb..683b076 100644 --- a/program/start.py +++ b/program/start.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + import asyncio from datetime import datetime @@ -20,6 +39,7 @@ from driver.database.dbchat import add_served_chat, is_served_chat from driver.database.dbpunish import is_gbanned_user from driver.database.dbusers import add_served_user from driver.database.dblockchat import blacklisted_chats + from pyrogram import Client, filters, __version__ as pyrover from pyrogram.errors import FloodWait from pytgcalls import (__version__ as pytover) From 75b76cfeb18e368265ba3e163d6536d6e29cd908 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:39:37 +0700 Subject: [PATCH 13/31] copyright header --- program/sysinfo.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/program/sysinfo.py b/program/sysinfo.py index d85bb6d..b86568c 100644 --- a/program/sysinfo.py +++ b/program/sysinfo.py @@ -1,18 +1,35 @@ -# Copyright (C) 2021 Veez Project +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + import re import uuid import socket - import psutil import platform + from config import BOT_USERNAME + from driver.filters import command -from pyrogram import Client, filters from driver.decorators import sudo_users_only, humanbytes +from pyrogram import Client, filters -# FETCH SYSINFO @Client.on_message(command(["sysinfo", f"sysinfo@{BOT_USERNAME}"]) & ~filters.edited) @sudo_users_only From 833bc12f3794a2d4ccf030eb093eed12973e79f4 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:41:07 +0700 Subject: [PATCH 14/31] copyright header --- ...userbot_tools.py => assistant_settings.py} | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) rename program/{userbot_tools.py => assistant_settings.py} (86%) diff --git a/program/userbot_tools.py b/program/assistant_settings.py similarity index 86% rename from program/userbot_tools.py rename to program/assistant_settings.py index 1110d21..5ce04ef 100644 --- a/program/userbot_tools.py +++ b/program/assistant_settings.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + import asyncio from config import BOT_USERNAME, SUDO_USERS From 9833ce3d230c3852d4070b44b3bf8c97f5721091 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:42:50 +0700 Subject: [PATCH 15/31] copyright header --- program/{video.py => video_stream.py} | 28 ++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) rename program/{video.py => video_stream.py} (96%) diff --git a/program/video.py b/program/video_stream.py similarity index 96% rename from program/video.py rename to program/video_stream.py index 7119d45..cd9bb07 100644 --- a/program/video.py +++ b/program/video_stream.py @@ -1,12 +1,26 @@ -# Copyright (C) 2021 By Veez Music-Project -# Commit Start Date 20/10/2021 -# Finished On 28/10/2021 +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" import re import asyncio import traceback -# repository stuff + from config import BOT_USERNAME, IMG_1, IMG_2, IMG_5 from driver.decorators import require_admin, check_blacklist from program.utils.inline import stream_markup @@ -17,11 +31,11 @@ from driver.queues import QUEUE, add_to_queue from driver.core import calls, user, me_user from driver.database.dbqueue import add_active_chat, remove_active_chat, music_on from driver.utils import remove_if_exists, from_tg_get_msg -# pyrogram stuff + from pyrogram import Client from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardMarkup, Message -# py-tgcalls stuff + from pytgcalls import idle from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioVideoPiped @@ -31,7 +45,7 @@ from pytgcalls.types.input_stream.quality import ( LowQualityVideo, MediumQualityVideo, ) -# youtube-dl stuff + from youtubesearchpython import VideosSearch From e8a42a024815e76bc861bcffd196d6db7245b06c Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 06:43:37 +0700 Subject: [PATCH 16/31] copyright header --- program/ytsearch.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/program/ytsearch.py b/program/ytsearch.py index ddfc76a..87952e5 100644 --- a/program/ytsearch.py +++ b/program/ytsearch.py @@ -1,3 +1,22 @@ +""" +Video + Music Stream Telegram Bot +Copyright (c) 2022-present levina=lab + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +""" + + from config import BOT_USERNAME from driver.decorators import check_blacklist from driver.filters import command From 1bccc0be311dd9f5bd8aaf4c47ef5f2e3377377a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 23 Feb 2022 07:04:14 +0700 Subject: [PATCH 17/31] unused --- driver/core.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/driver/core.py b/driver/core.py index 2ae6dec..d5bcc6c 100644 --- a/driver/core.py +++ b/driver/core.py @@ -17,11 +17,7 @@ user = Client( api_hash=API_HASH, ) -calls = PyTgCalls( - user, - cache_duration=180, - overload_quiet_mode=True -) +calls = PyTgCalls(user, overload_quiet_mode=True) with Client(":veez:", API_ID, API_HASH, bot_token=BOT_TOKEN) as app: From 218666561ba12169d421d6600d13212e41b29436 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 07:57:22 +0700 Subject: [PATCH 18/31] treewide: some fixes --- program/punishment.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/program/punishment.py b/program/punishment.py index 05aa236..eba3ab2 100644 --- a/program/punishment.py +++ b/program/punishment.py @@ -174,8 +174,21 @@ async def ungban_global(c: Client, message: Message): if not is_gbanned: await message.reply_text("This user is not gbanned !") else: - await c.unban_chat_member(chat_id, user.id) await remove_gban_user(user.id) + served_chats = [] + chats = await get_served_chats() + for chat in chats: + served_chats.append(int(chat["chat_id"])) + number_of_chats = 0 + for num in served_chats: + try: + await c.unban_chat_member(num, user.id) + number_of_chats += 1 + await asyncio.sleep(1) + except FloodWait as e: + await asyncio.sleep(int(e.x)) + except BaseException: + pass await message.reply_text("āœ… This user has ungbanned") return from_user_id = message.from_user.id @@ -195,6 +208,19 @@ async def ungban_global(c: Client, message: Message): if not is_gbanned: await message.reply_text("This user is not gbanned !") else: - await c.unban_chat_member(chat_id, user_id) await remove_gban_user(user_id) - await message.reply_text("āœ… This user has ungbanned") + served_chats = [] + chats = await get_served_chats() + for chat in chats: + served_chats.append(int(chat["chat_id"])) + number_of_chats = 0 + for num in served_chats: + try: + await c.unban_chat_member(num, user_id) + number_of_chats += 1 + await asyncio.sleep(1) + except FloodWait as e: + await asyncio.sleep(int(e.x)) + except BaseException: + pass + await message.reply_text("āœ… This user has ungbanned") From b651e773b45c237a52569cd29d814e305883490a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 09:32:23 +0700 Subject: [PATCH 19/31] treewide: some fixes & improvements --- program/music_stream.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/program/music_stream.py b/program/music_stream.py index 6d96252..4fe2c3f 100644 --- a/program/music_stream.py +++ b/program/music_stream.py @@ -27,6 +27,7 @@ from pytgcalls import idle from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioPiped from pytgcalls.types.input_stream.quality import HighQualityAudio +from pytgcalls.exceptions import NoAudioSourceFound, NoActiveGroupCall, GroupCallNotFound from driver.decorators import require_admin, check_blacklist from program.utils.inline import stream_markup @@ -170,11 +171,11 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str ) await idle() remove_if_exists(image) - except Exception as e: + except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() await remove_active_chat(chat_id) traceback.print_exc() - await m.reply_text(f"šŸš« error:\n\nĀ» {e}") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") else: await m.reply( "Ā» reply to an **audio file** or **give something to search.**" @@ -196,8 +197,10 @@ async def play(c: Client, m: Message): try: ubot = me_user.id b = await c.get_chat_member(chat_id, ubot) - if b.status == "kicked": - await c.unban_chat_member(chat_id, ubot) + if b.status == "banned": + try: + await m.reply_text("āŒ The userbot is banned in this chat, unban the userbot first to be able to play music !") + return invitelink = (await c.get_chat(chat_id)).invite_link if not invitelink: await c.export_chat_invite_link(chat_id) @@ -295,10 +298,14 @@ async def play(c: Client, m: Message): ) await idle() remove_if_exists(image) - except Exception as ep: + except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{ep}`") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except NoAudioSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no audio source") else: if len(m.command) < 2: @@ -366,7 +373,11 @@ async def play(c: Client, m: Message): ) await idle() remove_if_exists(image) - except Exception as ep: + except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{ep}`") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except NoAudioSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no audio source.\n\nĀ» Try to play another song or try again later !") From 937d6ed47acd91958d73dde795202a1e501f6e8a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 09:39:12 +0700 Subject: [PATCH 20/31] treewide: some fixes & improvements --- program/music_stream.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/program/music_stream.py b/program/music_stream.py index 4fe2c3f..f88362a 100644 --- a/program/music_stream.py +++ b/program/music_stream.py @@ -23,7 +23,6 @@ from pyrogram import Client from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardMarkup, Message -from pytgcalls import idle from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioPiped from pytgcalls.types.input_stream.quality import HighQualityAudio @@ -56,7 +55,6 @@ def ytsearch(query: str): print(e) return 0 - async def ytdl(link: str): stdout, stderr = await bash( f'yt-dlp --geo-bypass -g -f "best[height<=?720][width<=?1280]/best" {link}' @@ -169,7 +167,6 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str f"ā±ļø **Duration:** `{duration}`\n" f"šŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() @@ -296,7 +293,6 @@ async def play(c: Client, m: Message): reply_markup=InlineKeyboardMarkup(buttons), caption=f"šŸ—‚ **Name:** [{songname}]({url}) | `music`\n**ā± Duration:** `{duration}`\nšŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() @@ -371,7 +367,6 @@ async def play(c: Client, m: Message): reply_markup=InlineKeyboardMarkup(buttons), caption=f"šŸ—‚ **Name:** [{songname}]({url}) | `music`\n**ā± Duration:** `{duration}`\nšŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) except (NoActiveGroupCall, GroupCallNotFound): await suhu.delete() From 2cf26a72588ad9beaabdb3b655c210a05c5c0be8 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 09:46:30 +0700 Subject: [PATCH 21/31] treewide: some fixes & improvements --- program/music_stream.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/program/music_stream.py b/program/music_stream.py index f88362a..d7a0b35 100644 --- a/program/music_stream.py +++ b/program/music_stream.py @@ -195,17 +195,16 @@ async def play(c: Client, m: Message): ubot = me_user.id b = await c.get_chat_member(chat_id, ubot) if b.status == "banned": - try: - await m.reply_text("āŒ The userbot is banned in this chat, unban the userbot first to be able to play music !") - return + await m.reply_text("āŒ The userbot is banned in this chat, unban the userbot first to be able to play music !") + return + invitelink = (await c.get_chat(chat_id)).invite_link + if not invitelink: + await c.export_chat_invite_link(chat_id) invitelink = (await c.get_chat(chat_id)).invite_link - if not invitelink: - await c.export_chat_invite_link(chat_id) - invitelink = (await c.get_chat(chat_id)).invite_link - if invitelink.startswith("https://t.me/+"): - invitelink = invitelink.replace( - "https://t.me/+", "https://t.me/joinchat/" - ) + if invitelink.startswith("https://t.me/+"): + invitelink = invitelink.replace( + "https://t.me/+", "https://t.me/joinchat/" + ) await user.join_chat(invitelink) await remove_active_chat(chat_id) except UserNotParticipant: From f19605a7a5f0b6428088a0d2e6db453fa119bcd5 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:10:41 +0700 Subject: [PATCH 22/31] treewide: some fixes & improvements --- program/video_stream.py | 82 ++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/program/video_stream.py b/program/video_stream.py index cd9bb07..6938025 100644 --- a/program/video_stream.py +++ b/program/video_stream.py @@ -36,7 +36,6 @@ from pyrogram import Client from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardMarkup, Message -from pytgcalls import idle from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioVideoPiped from pytgcalls.types.input_stream.quality import ( @@ -45,6 +44,7 @@ from pytgcalls.types.input_stream.quality import ( LowQualityVideo, MediumQualityVideo, ) +from pytgcalls.exceptions import NoVideoSourceFound, NoActiveGroupCall, GroupCallNotFound from youtubesearchpython import VideosSearch @@ -152,6 +152,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str ) remove_if_exists(image) else: + try: await loser.edit("šŸ”„ Joining Group Call...") gcname = m.chat.title ctitle = await CHAT_TITLE(gcname) @@ -187,8 +188,12 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str f"ā±ļø **Duration:** `{duration}`\n" f"šŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) + except (NoActiveGroupCall, GroupCallNotFound): + await suhu.delete() + await remove_active_chat(chat_id) + traceback.print_exc() + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") else: await m.reply( "Ā» reply to an **video file** or **give something to search.**" @@ -210,16 +215,17 @@ async def vplay(c: Client, m: Message): try: ubot = me_user.id b = await c.get_chat_member(chat_id, ubot) - if b.status == "kicked": - await c.unban_chat_member(chat_id, ubot) + if b.status == "banned": + await m.reply_text("āŒ The userbot is banned in this chat, unban the userbot first to be able to play music !") + return + invitelink = (await c.get_chat(chat_id)).invite_link + if not invitelink: + await c.export_chat_invite_link(chat_id) invitelink = (await c.get_chat(chat_id)).invite_link - if not invitelink: - await c.export_chat_invite_link(chat_id) - invitelink = (await c.get_chat(chat_id)).invite_link - if invitelink.startswith("https://t.me/+"): - invitelink = invitelink.replace( - "https://t.me/+", "https://t.me/joinchat/" - ) + if invitelink.startswith("https://t.me/+"): + invitelink = invitelink.replace( + "https://t.me/+", "https://t.me/joinchat/" + ) await user.join_chat(invitelink) await remove_active_chat(chat_id) except UserNotParticipant: @@ -308,12 +314,19 @@ async def vplay(c: Client, m: Message): reply_markup=InlineKeyboardMarkup(buttons), caption=f"šŸ—‚ **Name:** [{songname}]({url}) | `video`\nā± **Duration:** `{duration}`\nšŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) - except Exception as ep: + except (NoActiveGroupCall, GroupCallNotFound): await loser.delete() await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{ep}`") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except NoVideoSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no video source") + except NoAudioSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no audio source") else: if len(m.command) < 2: @@ -384,12 +397,19 @@ async def vplay(c: Client, m: Message): reply_markup=InlineKeyboardMarkup(buttons), caption=f"šŸ—‚ **Name:** [{songname}]({url}) | `video`\nā± **Duration:** `{duration}`\nšŸ§ø **Request by:** {requester}", ) - await idle() remove_if_exists(image) - except Exception as ep: + except (NoActiveGroupCall, GroupCallNotFound): await loser.delete() await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{ep}`") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except NoVideoSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no video source") + except NoAudioSourceFound: + await suhu.delete() + await remove_active_chat(chat_id) + await m.reply_text("āŒ The content you provide to play has no audio source") @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters) @@ -406,16 +426,17 @@ async def vstream(c: Client, m: Message): try: ubot = me_user.id b = await c.get_chat_member(chat_id, ubot) - if b.status == "kicked": - await c.unban_chat_member(chat_id, ubot) + if b.status == "banned": + await m.reply_text("āŒ The userbot is banned in this chat, unban the userbot first to be able to play music !") + return + invitelink = (await c.get_chat(chat_id)).invite_link + if not invitelink: + await c.export_chat_invite_link(chat_id) invitelink = (await c.get_chat(chat_id)).invite_link - if not invitelink: - await c.export_chat_invite_link(chat_id) - invitelink = (await c.get_chat(chat_id)).invite_link - if invitelink.startswith("https://t.me/+"): - invitelink = invitelink.replace( - "https://t.me/+", "https://t.me/joinchat/" - ) + if invitelink.startswith("https://t.me/+"): + invitelink = invitelink.replace( + "https://t.me/+", "https://t.me/joinchat/" + ) await user.join_chat(invitelink) await remove_active_chat(chat_id) except UserNotParticipant: @@ -517,8 +538,11 @@ async def vstream(c: Client, m: Message): reply_markup=InlineKeyboardMarkup(buttons), caption=f"šŸ—‚ **Name:** [{songname}]({url}) | `live`\nšŸ§ø **Requested by:** {requester}", ) - await idle() - except Exception as ep: + except (NoActiveGroupCall, GroupCallNotFound): await loser.delete() await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{ep}`") + await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except BaseException as err: + await loser.delete() + await remove_active_chat(chat_id) + await m.reply_text(f"šŸš« error: `{err}`") From d8739b8e35c19e9f870e3605f96d236e4f2fb3e4 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:23:28 +0700 Subject: [PATCH 23/31] [check] some exceptions --- program/music_stream.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/program/music_stream.py b/program/music_stream.py index d7a0b35..abe7da2 100644 --- a/program/music_stream.py +++ b/program/music_stream.py @@ -173,6 +173,8 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str await remove_active_chat(chat_id) traceback.print_exc() await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except BaseException as err: + print(err) else: await m.reply( "Ā» reply to an **audio file** or **give something to search.**" @@ -301,6 +303,8 @@ async def play(c: Client, m: Message): await suhu.delete() await remove_active_chat(chat_id) await m.reply_text("āŒ The content you provide to play has no audio source") + except BaseException as err: + print(err) else: if len(m.command) < 2: @@ -375,3 +379,5 @@ async def play(c: Client, m: Message): await suhu.delete() await remove_active_chat(chat_id) await m.reply_text("āŒ The content you provide to play has no audio source.\n\nĀ» Try to play another song or try again later !") + except BaseException as err: + print(err) From 8ff19365a781414f654eca70921dc1bca5d6aac4 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:26:12 +0700 Subject: [PATCH 24/31] [check] some exceptions --- program/video_stream.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/program/video_stream.py b/program/video_stream.py index 6938025..ab95ea7 100644 --- a/program/video_stream.py +++ b/program/video_stream.py @@ -194,6 +194,8 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str await remove_active_chat(chat_id) traceback.print_exc() await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") + except BaseException as err: + print(err) else: await m.reply( "Ā» reply to an **video file** or **give something to search.**" @@ -327,6 +329,8 @@ async def vplay(c: Client, m: Message): await suhu.delete() await remove_active_chat(chat_id) await m.reply_text("āŒ The content you provide to play has no audio source") + except BaseException as err: + print(err) else: if len(m.command) < 2: @@ -410,6 +414,8 @@ async def vplay(c: Client, m: Message): await suhu.delete() await remove_active_chat(chat_id) await m.reply_text("āŒ The content you provide to play has no audio source") + except BaseException as err: + print(err) @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters) @@ -543,6 +549,4 @@ async def vstream(c: Client, m: Message): await remove_active_chat(chat_id) await m.reply_text("āŒ The bot can't find the Group call or it's inactive.\n\nĀ» Use /startvc command to turn on the Group call !") except BaseException as err: - await loser.delete() - await remove_active_chat(chat_id) - await m.reply_text(f"šŸš« error: `{err}`") + print(err) From 3b53eed1f83d8950b2c76dfa7e00e2a2971b66ce Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:53:00 +0700 Subject: [PATCH 25/31] [check] some changes --- program/callback.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/program/callback.py b/program/callback.py index 2777001..bd49ac1 100644 --- a/program/callback.py +++ b/program/callback.py @@ -17,7 +17,7 @@ along with this program. If not, see Date: Thu, 24 Feb 2022 10:57:02 +0700 Subject: [PATCH 26/31] [check] some changes --- program/music_stream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/program/music_stream.py b/program/music_stream.py index abe7da2..094622c 100644 --- a/program/music_stream.py +++ b/program/music_stream.py @@ -209,6 +209,8 @@ async def play(c: Client, m: Message): ) await user.join_chat(invitelink) await remove_active_chat(chat_id) + except UserAlreadyParticipant: + pass except UserNotParticipant: try: invitelink = (await c.get_chat(chat_id)).invite_link From 9600f22159d90ad0a3d397f3c9a308954dade56f Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:58:17 +0700 Subject: [PATCH 27/31] [check] some changes --- program/video_stream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/program/video_stream.py b/program/video_stream.py index ab95ea7..e6db85a 100644 --- a/program/video_stream.py +++ b/program/video_stream.py @@ -230,6 +230,8 @@ async def vplay(c: Client, m: Message): ) await user.join_chat(invitelink) await remove_active_chat(chat_id) + except UserAlreadyParticipant: + pass except UserNotParticipant: try: invitelink = (await c.get_chat(chat_id)).invite_link From e386a41ab2b2606e50b92647a9d2ce51e9866756 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 11:27:50 +0700 Subject: [PATCH 28/31] [check] some changes --- program/start.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/program/start.py b/program/start.py index 683b076..264a325 100644 --- a/program/start.py +++ b/program/start.py @@ -79,10 +79,9 @@ async def _human_time_duration(seconds): ) @check_blacklist() async def start_(c: Client, message: Message): - BOT_NAME = me_bot.first_name await message.reply_text( f"""āœØ **Welcome {message.from_user.mention()} !**\n -šŸ’­ [{BOT_NAME}](https://t.me/{BOT_USERNAME}) **Is a bot to play music and video in groups, through the Telegram Group video chat!** +šŸ’­ [{me_bot.first_name}](https://t.me/{BOT_USERNAME}) **Is a bot to play music and video in groups, through the Telegram Group video chat!** šŸ’” **Find out all the Bot's commands and how they work by clicking on the Ā» šŸ“š Commands button!** @@ -129,7 +128,6 @@ async def alive(c: Client, message: Message): current_time = datetime.utcnow() uptime_sec = (current_time - START_TIME).total_seconds() uptime = await _human_time_duration(int(uptime_sec)) - BOT_NAME = me_bot.first_name keyboard = InlineKeyboardMarkup( [ @@ -142,7 +140,7 @@ async def alive(c: Client, message: Message): ] ) - alive = f"**Hello {message.from_user.mention()}, i'm {BOT_NAME}**\n\nšŸ§‘šŸ¼ā€šŸ’» My Master: [{ALIVE_NAME}](https://t.me/{OWNER_USERNAME})\nšŸ‘¾ Bot Version: `v{__version__}`\nšŸ”„ Pyrogram Version: `{pyrover}`\nšŸ Python Version: `{__python_version__}`\nāœØ PyTgCalls Version: `{pytover.__version__}`\nšŸ†™ Uptime Status: `{uptime}`\n\nā¤ **Thanks for Adding me here, for playing video & music on your Group's video chat**" + alive = f"**Hello {message.from_user.mention()}, I'm {me_bot.first_name}**\n\nšŸ§‘šŸ¼ā€šŸ’» My Master: [{ALIVE_NAME}](https://t.me/{OWNER_USERNAME})\nšŸ‘¾ Bot Version: `v{__version__}`\nšŸ”„ Pyrogram Version: `{pyrover}`\nšŸ Python Version: `{__python_version__}`\nāœØ PyTgCalls Version: `{pytover.__version__}`\nšŸ†™ Uptime Status: `{uptime}`\n\nā¤ **Thanks for Adding me here, for playing video & music on your Group's video chat**" await c.send_photo( chat_id, @@ -192,15 +190,13 @@ async def new_chat(c: Client, m: Message): pass else: await add_served_chat(chat_id) - ass_uname = me_user.username - bot_id = me_bot.id for member in m.new_chat_members: if chat_id in await blacklisted_chats(): await m.reply( "ā—ļø This chat has blacklisted by sudo user and You're not allowed to use me in this chat." ) return await bot.leave_chat(chat_id) - if member.id == bot_id: + if member.id == me_bot.id: return await m.reply( "ā¤ļø Thanks for adding me to the **Group** !\n\n" "Appoint me as administrator in the **Group**, otherwise I will not be able to work properly, and don't forget to type `/userbotjoin` for invite the assistant.\n\n" @@ -212,7 +208,7 @@ async def new_chat(c: Client, m: Message): InlineKeyboardButton("šŸ’­ Support", url=f"https://t.me/{GROUP_SUPPORT}") ], [ - InlineKeyboardButton("šŸ‘¤ Assistant", url=f"https://t.me/{ass_uname}") + InlineKeyboardButton("šŸ‘¤ Assistant", url=f"https://t.me/{me_user.username}") ] ] ) From c8a62b402e0dfe8f79dbf59f9b6783d05a7d093a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 11:35:15 +0700 Subject: [PATCH 29/31] [check] some changes --- program/punishment.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/program/punishment.py b/program/punishment.py index eba3ab2..d861b8b 100644 --- a/program/punishment.py +++ b/program/punishment.py @@ -174,6 +174,7 @@ async def ungban_global(c: Client, message: Message): if not is_gbanned: await message.reply_text("This user is not gbanned !") else: + msg = await message.reply_text("Ā» ungbanning user...") await remove_gban_user(user.id) served_chats = [] chats = await get_served_chats() @@ -189,7 +190,7 @@ async def ungban_global(c: Client, message: Message): await asyncio.sleep(int(e.x)) except BaseException: pass - await message.reply_text("āœ… This user has ungbanned") + await msg.edit_text("āœ… This user has ungbanned") return from_user_id = message.from_user.id user_id = message.reply_to_message.from_user.id @@ -208,6 +209,7 @@ async def ungban_global(c: Client, message: Message): if not is_gbanned: await message.reply_text("This user is not gbanned !") else: + msg = await message.reply_text("Ā» ungbanning user...") await remove_gban_user(user_id) served_chats = [] chats = await get_served_chats() @@ -223,4 +225,4 @@ async def ungban_global(c: Client, message: Message): await asyncio.sleep(int(e.x)) except BaseException: pass - await message.reply_text("āœ… This user has ungbanned") + await msg.edit_text("āœ… This user has ungbanned") From 328558d754ee4d7ea6e201a7e24c42d27554a008 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 11:56:39 +0700 Subject: [PATCH 30/31] [check] some changes --- program/assistant_settings.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/program/assistant_settings.py b/program/assistant_settings.py index 5ce04ef..cc5d32b 100644 --- a/program/assistant_settings.py +++ b/program/assistant_settings.py @@ -23,6 +23,7 @@ from config import BOT_USERNAME, SUDO_USERS from program.utils.function import get_calls +from driver.queues import QUEUE from driver.core import user, me_bot from driver.filters import command, other_filters from driver.database.dbchat import remove_served_chat @@ -161,6 +162,11 @@ async def bot_kicked(c: Client, m: Message): chat_id = m.chat.id left_member = m.left_chat_member if left_member.id == bot_id: - await user.leave_chat(chat_id) - await remove_served_chat(chat_id) - await remove_active_chat(chat_id) + if chat_id in QUEUE: + await remove_active_chat(chat_id) + return + try: + await user.leave_chat(chat_id) + await remove_served_chat(chat_id) + except BaseException as err: + print(err) From 346012c9cad5640ee2b4013d24d8e813b4e6f645 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Thu, 24 Feb 2022 12:02:44 +0700 Subject: [PATCH 31/31] [check] some changes --- program/developer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/program/developer.py b/program/developer.py index f3ec21d..c5e310c 100644 --- a/program/developer.py +++ b/program/developer.py @@ -28,6 +28,7 @@ from inspect import getfullargspec from config import BOT_USERNAME as bname from driver.core import bot +from driver.queues import QUEUE from driver.filters import command from driver.database.dbchat import remove_served_chat from driver.decorators import bot_creator, sudo_users_only, errors @@ -198,11 +199,14 @@ async def bot_leave_group(_, message): ) return chat = message.text.split(None, 2)[1] + if chat in QUEUE: + await remove_active_chat(chat) + return try: await bot.leave_chat(chat) + await user.leave_chat(chat) await remove_served_chat(chat) except Exception as e: await message.reply_text(f"āŒ procces failed\n\nreason: `{e}`") - print(e) return await message.reply_text(f"āœ… Bot successfully left from the Group:\n\nšŸ’­ Ā» `{chat}`")