Skip to content

Commit

Permalink
Create mustjoin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Badhacker98 authored Aug 31, 2024
1 parent 33ee33a commit da7c821
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Spotify_Music/plugins/BAD(PB05)/mustjoin.py
Original file line number Diff line number Diff line change
@@ -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} !")

0 comments on commit da7c821

Please sign in to comment.