Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
AM-ROBOTS authored Oct 11, 2022
1 parent 43dcbdc commit 440d999
Show file tree
Hide file tree
Showing 12 changed files with 2,785 additions and 0 deletions.
40 changes: 40 additions & 0 deletions plugins/banned.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from pyrogram import Client, filters
from utils import temp
from pyrogram.types import Message
from database.users_chats_db import db
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
from info import SUPPORT_CHAT

async def banned_users(_, client, message: Message):
return (
message.from_user is not None or not message.sender_chat
) and message.from_user.id in temp.BANNED_USERS

banned_user = filters.create(banned_users)

async def disabled_chat(_, client, message: Message):
return message.chat.id in temp.BANNED_CHATS

disabled_group=filters.create(disabled_chat)


@Client.on_message(filters.private & banned_user & filters.incoming)
async def ban_reply(bot, message):
ban = await db.get_ban_status(message.from_user.id)
await message.reply(f'Sorry Dude, You are Banned to use Me. \nBan Reason: {ban["ban_reason"]}')

@Client.on_message(filters.group & disabled_group & filters.incoming)
async def grp_bd(bot, message):
buttons = [[
InlineKeyboardButton('𝚂𝚞𝚙𝚙𝚘𝚛𝚝', url=f'https://t.me/MOVIES_ZILAA')
]]
reply_markup=InlineKeyboardMarkup(buttons)
vazha = await db.get_chat(message.chat.id)
k = await message.reply(
text=f"CHAT NOT ALLOWED 🐞\n\nMy admins has restricted me from working here ! If you want to know more about it contact support..\nReason : <code>{vazha['reason']}</code>.",
reply_markup=reply_markup)
try:
await k.pin()
except:
pass
await bot.leave_chat(message.chat.id)
42 changes: 42 additions & 0 deletions plugins/broadcast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

from pyrogram import Client, filters
import datetime
import time
from database.users_chats_db import db
from info import ADMINS
from utils import broadcast_messages
import asyncio

@Client.on_message(filters.command("broadcast") & filters.user(ADMINS) & filters.reply)
# https://t.me/GetTGLink/4178
async def verupikkals(bot, message):
users = await db.get_all_users()
b_msg = message.reply_to_message
sts = await message.reply_text(
text='Broadcasting your messages...'
)
start_time = time.time()
total_users = await db.total_users_count()
done = 0
blocked = 0
deleted = 0
failed =0

success = 0
async for user in users:
pti, sh = await broadcast_messages(int(user['id']), b_msg)
if pti:
success += 1
elif pti == False:
if sh == "Blocked":
blocked+=1
elif sh == "Deleted":
deleted += 1
elif sh == "Error":
failed += 1
done += 1
await asyncio.sleep(2)
if not done % 20:
await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}")
time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}")
20 changes: 20 additions & 0 deletions plugins/channel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from pyrogram import Client, filters
from info import CHANNELS
from database.ia_filterdb import save_file

media_filter = filters.document | filters.video | filters.audio


@Client.on_message(filters.chat(CHANNELS) & media_filter)
async def media(bot, message):
"""Media Handler"""
for file_type in ("document", "video", "audio"):
media = getattr(message, file_type, None)
if media is not None:
break
else:
return

media.file_type = file_type
media.caption = message.caption
await save_file(media)
Loading

0 comments on commit 440d999

Please sign in to comment.