From da7c821666ddeceb91c098c59a18b982ce5db3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=99=E1=B4=80=E1=B4=85=20=CA=99=E1=B4=80=CA=99=CA=8F?= <154504921+Badhacker98@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:35:29 +0530 Subject: [PATCH] Create mustjoin.py --- Spotify_Music/plugins/BAD(PB05)/mustjoin.py | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Spotify_Music/plugins/BAD(PB05)/mustjoin.py diff --git a/Spotify_Music/plugins/BAD(PB05)/mustjoin.py b/Spotify_Music/plugins/BAD(PB05)/mustjoin.py new file mode 100644 index 0000000..de8a457 --- /dev/null +++ b/Spotify_Music/plugins/BAD(PB05)/mustjoin.py @@ -0,0 +1,38 @@ +from pyrogram import Client, filters +from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message +from pyrogram.errors import ChatAdminRequired, UserNotParticipant, ChatWriteForbidden +from Spotify_Music import app + +#-------------------------- + +MUST_JOIN = "ll_THE_BAD_BOT_ll" +#------------------------ +@app.on_message(filters.incoming & filters.private, group=-1) +async def must_join_channel(app: Client, msg: Message): + if not MUST_JOIN: + return + try: + try: + await app.get_chat_member(MUST_JOIN, msg.from_user.id) + except UserNotParticipant: + if MUST_JOIN.isalpha(): + link = "https://t.me/" + MUST_JOIN + else: + chat_info = await app.get_chat(MUST_JOIN) + link = chat_info.invite_link + try: + await msg.reply_photo( + photo="https://telegra.ph/file/d44e57c7d8586edf6ee18.jpg", caption=f"๏ ᴀᴄᴄᴏʀᴅɪɴɢ ᴛᴏ ᴍʏ ᴅᴀᴛᴀʙᴀsᴇ ʏᴏᴜ'ᴠᴇ ɴᴏᴛ ᴊᴏɪɴᴇᴅ [๏sᴜᴘᴘᴏʀᴛ๏]({link}) ʏᴇᴛ, ɪғ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴜsᴇ ᴍᴇ ᴛʜᴇɴ ᴊᴏɪɴ [๏sᴜᴘᴘᴏʀᴛ๏]({link}) ᴀɴᴅ sᴛᴀʀᴛ ᴍᴇ ᴀɢᴀɪɴ ! ", + reply_markup=InlineKeyboardMarkup( + [ + [ + InlineKeyboardButton("๏Jᴏɪɴ๏", url=link), + ] + ] + ) + ) + await msg.stop_propagation() + except ChatWriteForbidden: + pass + except ChatAdminRequired: + print(f"๏ᴘʀᴏᴍᴏᴛᴇ ᴍᴇ ᴀs ᴀɴ ᴀᴅᴍɪɴ ɪɴ ᴛʜᴇ ᴍᴜsᴛ_Jᴏɪɴ ᴄʜᴀᴛ ๏: {MUST_JOIN} !")