-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Vivek Kumar <[email protected]>
- Loading branch information
1 parent
e382512
commit 659a049
Showing
2 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,94 @@ | ||
# This code is written by (C) TheTeamAlexa bot will send message to log group when someone add | ||
# this bot to new group make sure to star all projects | ||
# Copyright (C) 2021-2025 by Alexa_Help@ Github, < TheTeamAlexa >. | ||
# A Powerful Music Bot Property Of Rocks Indian Largest Chatting Group | ||
# All rights reserved. © Alisha © Alexa © Yukki | ||
# All rights reserved. © Alexa © Yukki | ||
|
||
from pyrogram import Client, filters | ||
from pyrogram.types import Message | ||
from pyrogram import filters | ||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message | ||
from config import LOG, LOG_GROUP_ID | ||
from AlexaMusic import app | ||
from AlexaMusic.utils.database import get_served_chats | ||
from config import LOG_GROUP_ID | ||
from AlexaMusic.utils.database import delete_served_chat, get_assistant, is_on_off | ||
|
||
|
||
async def lul_message(chat_id: int, message: str): | ||
await app.send_message(chat_id=chat_id, text=message) | ||
@app.on_message(filters.new_chat_members) | ||
async def bot_added(_, message): | ||
try: | ||
if not await is_on_off(LOG): | ||
return | ||
userbot = await get_assistant(message.chat.id) | ||
chat = message.chat | ||
for members in message.new_chat_members: | ||
if members.id == app.id: | ||
count = await app.get_chat_members_count(chat.id) | ||
username = ( | ||
message.chat.username if message.chat.username else "Private Chat" | ||
) | ||
msg = ( | ||
f"<b>Bot added in</b> {message.chat.title}\n\n" | ||
f"<b>Name:</b> {message.chat.title}\n" | ||
f"<b>Id:</b> {message.chat.id}\n" | ||
f"<b>Username:</b> @{username}\n" | ||
f"<b>Added By:</b> {message.from_user.mention}" | ||
) | ||
await app.send_message( | ||
LOG_GROUP_ID, | ||
text=msg, | ||
reply_markup=InlineKeyboardMarkup( | ||
[ | ||
[ | ||
InlineKeyboardButton( | ||
text=f"Added by: {message.from_user.first_name}", | ||
user_id=message.from_user.id, | ||
) | ||
] | ||
] | ||
), | ||
) | ||
if message.chat.username: | ||
await userbot.join_chat(message.chat.username) | ||
except Exception: | ||
pass | ||
|
||
|
||
@app.on_message(filters.new_chat_members) | ||
async def on_new_chat_members(client: Client, message: Message): | ||
if (await client.get_me()).id in [user.id for user in message.new_chat_members]: | ||
added_by = message.from_user.first_name if message.from_user else "ᴜɴᴋɴᴏᴡɴ ᴜsᴇʀ" | ||
matlabi_jhanto = message.chat.title | ||
served_chats = len(await get_served_chats()) | ||
chat_id = message.chat.id | ||
if message.chat.username: | ||
chatusername = f"@{message.chat.username}" | ||
else: | ||
chatusername = "ᴩʀɪᴠᴀᴛᴇ ᴄʜᴀᴛ" | ||
lemda_text = f"🌹 ʙᴏᴛ ᴀᴅᴅᴇᴅ ᴛᴏ ɴᴇᴡ ɢʀᴏᴜᴘ ..\n\n┏━━━━━━━━━━━━━━━━━┓\n┣★ **ᴄʜᴀᴛ** › : {matlabi_jhanto}\n┣★ **ᴄʜᴀᴛ ɪᴅ** › : {chat_id}\n┣★ **ᴄʜᴀᴛ ᴜɴᴀᴍᴇ** › : {chatusername}\n┣★ **ᴛᴏᴛᴀʟ ᴄʜᴀᴛ** › : {served_chats}\n┣★ **ᴀᴅᴅᴇᴅ ʙʏ** › :\n┗━━━ {added_by}" | ||
await lul_message(LOG_GROUP_ID, lemda_text) | ||
@app.on_message(filters.left_chat_member) | ||
async def bot_kicked(_, message: Message): | ||
try: | ||
if not await is_on_off(LOG): | ||
return | ||
userbot = await get_assistant(message.chat.id) | ||
left_chat_member = message.left_chat_member | ||
if left_chat_member and left_chat_member.id == app.id: | ||
remove_by = ( | ||
message.from_user.mention if message.from_user else "Unknown User" | ||
) | ||
title = message.chat.title | ||
username = ( | ||
f"@{message.chat.username}" if message.chat.username else "Private Chat" | ||
) | ||
chat_id = message.chat.id | ||
left = ( | ||
f"Bot was Removed in {title}\n" | ||
f"<b>Name</b>: {title}\n" | ||
f"<b>Id</b>: {chat_id}\n" | ||
f"<b>Username</b>: {username}\n" | ||
f"<b>Removed By</b>: {remove_by}" | ||
) | ||
|
||
await app.send_message( | ||
LOG_GROUP_ID, | ||
text=left, | ||
reply_markup=InlineKeyboardMarkup( | ||
[ | ||
[ | ||
InlineKeyboardButton( | ||
text=f"Removed By: {message.from_user.first_name}", | ||
user_id=message.from_user.id, | ||
) | ||
] | ||
] | ||
), | ||
) | ||
await delete_served_chat(chat_id) | ||
await userbot.leave_chat(chat_id) | ||
except Exception as e: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters