diff --git a/telebot/plugins/dpmanager.py b/telebot/plugins/dpmanager.py new file mode 100644 index 00000000..42df5b88 --- /dev/null +++ b/telebot/plugins/dpmanager.py @@ -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 ": "Delete last given numbers of profile pictures.", + "dpcount": "Count your current profile pictures", + } +) diff --git a/telebot/plugins/getall.py b/telebot/plugins/getall.py new file mode 100644 index 00000000..547ddbb3 --- /dev/null +++ b/telebot/plugins/getall.py @@ -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."} +)