Skip to content

Commit

Permalink
Update chatlog.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiModszYT authored Jun 7, 2024
1 parent 011ab95 commit 0461de5
Showing 1 changed file with 39 additions and 40 deletions.
79 changes: 39 additions & 40 deletions FIXXMUSIC/plugins/tools/chatlog.py
Original file line number Diff line number Diff line change
@@ -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"โœซ <b><u>ษดแด‡แดก ษขส€แดแดœแด˜</u></b> :\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"โœซ <b><u>#๐‹แด‡า“แด›_๐†ส€แดแดœแด˜</u></b> โœซ\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"โœซ <b><u>สŸแด‡า“แด› ษขส€แดแดœแด˜</u></b> :\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)

0 comments on commit 0461de5

Please sign in to comment.