Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions telebot/plugins/dpmanager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Author: Shubhendra Kushwaha
# @TheShubhendra (shubhendrakushwaha94@gmail.com)

from telethon.tl.functions.photos import DeletePhotosRequest
from telethon.tl.types import InputPhoto
from telebot import CMD_HELP


@telebot.on(admin_cmd(pattern="deldpall"))
async def delete_all_dp(event):
client = event.client
pics = await client.get_profile_photos("me")
await event.edit(f"`Going to delete {len(pics)} profile pics`")
for pic in pics:
await client(
DeletePhotosRequest(
id=[
InputPhoto(
id=pic.id,
access_hash=pic.access_hash,
file_reference=pic.file_reference,
)
]
)
)


@telebot.on(admin_cmd(pattern="deldp +(.*)"))
async def delete_all_dp(event):
client = event.client
pics = await client.get_profile_photos("me")
try:
n = int(event.pattern_match.group(1))
except BaseException:
return
if n > len(pics):
n = len(pics)
await event.edit(f"`Going to delete {n} profile pics`")
for i in range(n):
pic = pics[i]
await client(
DeletePhotosRequest(
id=[
InputPhoto(
id=pic.id,
access_hash=pic.access_hash,
file_reference=pic.file_reference,
)
]
)
)


@telebot.on(admin_cmd(pattern="dpcount ?(.*)"))
async def dp_count(event):
client = event.client
pics = await client.get_profile_photos("me")
await event.edit(f"`{len(pics)} pics found on your profile`")


CMD_HELP.update(
{
"deldpall": "Deletes your all profile pictures.",
"deldp <number>": "Delete last given numbers of profile pictures.",
"dpcount": "Count your current profile pictures",
}
)
19 changes: 19 additions & 0 deletions telebot/plugins/getall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Author: Shubhendra Kushwaha
# @TheShubhendra (shubhendrakushwaha94@gmail.com)
from telebot import CMD_HELP


@telebot.on(admin_cmd(pattern=r"getall$", outgoing=True))
async def _(event):
if event.fwd_from:
return
text = "`First Name| Last Name | Username | Id`"
chat = await event.get_input_chat()
async for x in bot.iter_participants(chat, 200):
text += f"\n**{x.first_name} | {x.last_name}** | @{x.username} | {x.id}"
await event.edit(text)


CMD_HELP.update(
{"getall": "get name , username and user_id of all members of a particular chat."}
)