From 0461de501bbdd23afea849b95828d5800f559181 Mon Sep 17 00:00:00 2001
From: AbhiModszYT <133230865+AbhiModszYT@users.noreply.github.com>
Date: Sat, 8 Jun 2024 03:43:28 +0530
Subject: [PATCH] Update chatlog.py
---
FIXXMUSIC/plugins/tools/chatlog.py | 79 +++++++++++++++---------------
1 file changed, 39 insertions(+), 40 deletions(-)
diff --git a/FIXXMUSIC/plugins/tools/chatlog.py b/FIXXMUSIC/plugins/tools/chatlog.py
index 7fc4256..21e3c9a 100644
--- a/FIXXMUSIC/plugins/tools/chatlog.py
+++ b/FIXXMUSIC/plugins/tools/chatlog.py
@@ -1,51 +1,50 @@
import random
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
-from config import LOGGER_ID as LOG_GROUP_ID
+from config import LOGGER_ID as BOTADDLOGS
from FIXXMUSIC import app
-from pyrogram.errors import RPCError
-from typing import Union, Optional
-from PIL import Image, ImageDraw, ImageFont
-import asyncio, os, aiohttp
-from pathlib import Path
-from pyrogram.enums import ParseMode
+from pyrogram import Client, filters
+from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup
-photo = [
- "https://telegra.ph/file/1949480f01355b4e87d26.jpg",
- "https://telegra.ph/file/3ef2cc0ad2bc548bafb30.jpg",
- "https://telegra.ph/file/a7d663cd2de689b811729.jpg",
- "https://telegra.ph/file/6f19dc23847f5b005e922.jpg",
- "https://telegra.ph/file/2973150dd62fd27a3a6ba.jpg",
-]
+async def new_message(chat_id: int, message: str, reply_markup=None):
+ await app.send_message(chat_id=chat_id, text=message, reply_markup=reply_markup)
-@app.on_message(filters.new_chat_members, group=2)
-async def join_watcher(_, message):
- chat = message.chat
- link = await app.export_chat_invite_link(chat.id)
- for member in message.new_chat_members:
- if member.id == app.id:
- count = await app.get_chat_members_count(chat.id)
- msg = (
- f"📝 ᴍᴜsɪᴄ ʙᴏᴛ ᴀᴅᴅᴇᴅ ɪɴ ᴀ ɴᴇᴡ ɢʀᴏᴜᴘ\n\n"
- f"____________________________________\n\n"
- f"📌 ᴄʜᴀᴛ ɴᴀᴍᴇ: {chat.title}\n"
- f"🍂 ᴄʜᴀᴛ ɪᴅ: {chat.id}\n"
- f"🔐 ᴄʜᴀᴛ ᴜsᴇʀɴᴀᴍᴇ: @{chat.username}\n"
- f"🛰 ᴄʜᴀᴛ ʟɪɴᴋ: [ᴄʟɪᴄᴋ]({link})\n"
- f"📈 ɢʀᴏᴜᴘ ᴍᴇᴍʙᴇʀs: {count}\n"
- f"🤔 ᴀᴅᴅᴇᴅ ʙʏ: {message.from_user.mention}"
- )
- await app.send_photo(LOG_GROUP_ID, photo=random.choice(photo), caption=msg, reply_markup=InlineKeyboardMarkup([
- [InlineKeyboardButton(f"sᴇᴇ ɢʀᴏᴜᴘ👀", url=f"{link}")]
- ]))
+@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.mention if message.from_user else "ᴜɴᴋɴᴏᴡɴ ᴜsᴇʀ"
+ title = message.chat.title
+ username = f"@{message.chat.username}"
+ chat_id = message.chat.id
+ am = f"✫ ɴᴇᴡ ɢʀᴏᴜᴘ :\n\nᴄʜᴀᴛ ɪᴅ : {chat_id}\nᴄʜᴀᴛ ᴜsᴇʀɴᴀᴍᴇ : {username}\nᴄʜᴀᴛ ᴛɪᴛʟᴇ : {title}\n\nᴀᴅᴅᴇᴅ ʙʏ : {added_by}"
+ reply_markup = InlineKeyboardMarkup([
+ [
+ InlineKeyboardButton(
+ message.from_user.first_name,
+ user_id=message.from_user.id
+ )
+ ]
+])
+
+
+ await new_message(BOTADDLOGS, am, reply_markup)
@app.on_message(filters.left_chat_member)
-async def on_left_chat_member(_, message: Message):
- if (await app.get_me()).id == message.left_chat_member.id:
- remove_by = message.from_user.mention if message.from_user else "𝐔ɴᴋɴᴏᴡɴ 𝐔sᴇʀ"
+async def on_left_chat_member(client: Client, message: Message):
+ if (await client.get_me()).id == message.left_chat_member.id:
+ remove_by = message.from_user.mention if message.from_user else "ᴜɴᴋɴᴏᴡɴ ᴜsᴇʀ"
title = message.chat.title
- username = f"@{message.chat.username}" if message.chat.username else "𝐏ʀɪᴠᴀᴛᴇ 𝐂ʜᴀᴛ"
+ username = f"@{message.chat.username}"
chat_id = message.chat.id
- left = f"✫ #𝐋ᴇғᴛ_𝐆ʀᴏᴜᴘ ✫\n\n𝐂ʜᴀᴛ 𝐓ɪᴛʟᴇ : {title}\n\n𝐂ʜᴀᴛ 𝐈ᴅ : {chat_id}\n\n𝐑ᴇᴍᴏᴠᴇᴅ 𝐁ʏ : {remove_by}\n\n𝐁ᴏᴛ : @{app.username}"
- await app.send_photo(LOG_GROUP_ID, photo=random.choice(photo), caption=left)
+ ambye = f"✫ ʟᴇғᴛ ɢʀᴏᴜᴘ :\n\nᴄʜᴀᴛ ɪᴅ : {chat_id}\nᴄʜᴀᴛ ᴜsᴇʀɴᴀᴍᴇ : {username}\nᴄʜᴀᴛ ᴛɪᴛʟᴇ : {title}\n\nʀᴇᴍᴏᴠᴇᴅ ʙʏ : {remove_by}"
+ reply_markup = InlineKeyboardMarkup([
+ [
+ InlineKeyboardButton(
+ message.from_user.first_name,
+ user_id=message.from_user.id
+ )
+ ]
+])
+
+ await new_message(BOTADDLOGS, ambye, reply_markup)