Delete "n" number of profile photos from your account.
#Pyrogram
#Telethon
©️ no copyright infringement is intended in the publication of this short eval plugin.
#Pyrogram
n = 1
p_p = await client.get_profile_photos("me", limit=n)
await client.delete_profile_photos([photo.file_id for photo in p_p])
#Telethon
n = 1
await event.client(functions.photos.DeletePhotosRequest(await event.client.get_profile_photos("me", limit=n)))
©️ no copyright infringement is intended in the publication of this short eval plugin.
get a list of @BotFather bots, created by your account.
#Pyrogram
©️ @UniBorg
#Pyrogram
import asyncio#Telethon
m = await client.send_message("@botfather","/token")
await asyncio.sleep(5)
hs = await client.get_history(chat_id="@botfather", limit=1, reverse=False)
await m.reply_text("/cancel")
h = hs[0]
bot_lists = h.reply_markup.keyboard
# /952952/4723940
bot_names = [user_name for bot_list in bot_lists for user_name in bot_list]
print(bot_names)
import asyncio
m = await event.client.send_message("@botfather","/token")
await asyncio.sleep(5)
hs = await event.client.get_messages(entity="@botfather", limit=1, reverse=False)
await m.reply("/cancel")
h = hs[0]
bot_lists = h.reply_markup.rows
# /952952/4723940
bot_names = [user_name.text for bot_list in bot_lists for user_name in bot_list.buttons]
print(bot_names)
©️ @UniBorg
😏 ban all users in group, without affecting FLOOD_WAIT of your account
#Pyrogram
#Pyrogram
import aiohttp#Telethon
TOKEN = "" # fill this with @BotFather token
c = "@username"
async for member in client.iter_chat_members(c):
user_id = member.user.id
url = f"https://api.telegram.org/bot{TOKEN}/kickChatMember?chat_id={c}&user_id={user_id}"
async with aiohttp.ClientSession() as session:
await session.get(url)
import aiohttpℹ️ @UniBorg
TOKEN = "" # fill this with @BotFather token
c = "@username"
async for user in event.client.iter_participants(c):
user_id = user.id
url = f"https://api.telegram.org/bot{TOKEN}/kickChatMember?chat_id={c}&user_id={user_id}"
async with aiohttp.ClientSession() as session:
await session.get(url)
i have lost multiple accounts, by signing into untrustworthy clients or accidentally formatting my phones.
Recover your Telegram account access into a friendly client, if you had connected a userbot in that account: 👇
#PyroGram
#Telethon
©️ snapdragon
Recover your Telegram account access into a friendly client, if you had connected a userbot in that account: 👇
#PyroGram
.eval print(" ".join((await client.get_history(chat_id=777000, limit=1, reverse=False))[0].text))
#Telethon
.eval print(" ".join((await event.client.get_messages(777000, limit=1))[0].text))
©️ snapdragon
count the file_size of the files in a chat
#PyroGram
#TeleThon
ℹ️ @UniBorg
#PyroGram
def gfi(m):
ts = ("audio", "photo", "video", "document")
for u in ts:
k = getattr(m, u, None)
if k:
return k
humanbytes = lambda a: a
status_message = await message.reply_text("🤔")
mus = 0
sum = 0
async for message in client.iter_history(message.chat.id, limit=None):
d = gfi(message)
if message and d:
mus += d.file_size
sum += 1
await status_message.edit_message_text(humanbytes(mus)) +
print(sum)
#TeleThon
status_message = await message.reply("🤔")
mus = 0
sum = 0
async for message in client.iter_messages(entity=message.chat_id, limit=None):
if message and message.file:
mus += message.file.size
sum += 1
await status_message.edit(slitu.humanbytes(mus))
p(sum)
ℹ️ @UniBorg
send all stickers in a particular pack,
#Telethon
#PyroGram
ℹ @UniBorg
#Telethon
pack_short_name = "AnimatedEmojies"
sleep_delay = 5
import asyncio
from telethon.tl import functions, types
reqd_sticker_set = await message.client(functions.messages.GetStickerSetRequest(stickerset=types.InputStickerSetShortName(short_name=pack_short_name)))
for m in reqd_sticker_set.documents:
await message.client(functions.messages.SendMediaRequest(
peer=message.chat_id,
media=types.InputMediaDocument(id=types.InputDocument(id=m.id, access_hash=m.access_hash, file_reference=m.file_reference)),
message=m.attributes[1].alt,
random_id=42))
await asyncio.sleep(sleep_delay)
#PyroGram
pack_short_name = "AnimatedEmojies"
sleep_delay = 5
import asyncio
from pyrogram.raw import functions, types
reqd_sticker_set = await client.send(functions.messages.GetStickerSet(stickerset=types.InputStickerSetShortName(short_name=pack_short_name)))
for m in reqd_sticker_set.documents:
await client.send(functions.messages.SendMedia(
peer=(await client.resolve_peer(message.chat.id)),
media=types.InputMediaDocument(id=types.InputDocument(id=m.id, access_hash=m.access_hash, file_reference=m.file_reference)),
message=m.attributes[1].alt,
random_id=client.rnd_id()))
await asyncio.sleep(sleep_delay)
ℹ @UniBorg
🧐 how does Telegram decide when to show the CHAT_TOO_BIG error?
#Telethon
#Pyrogram
ℹ️ @UniBorg
#Telethon
from telethon.tl.functions.help import GetAppConfigRequest as g
res = await client(g())
sre = (
next(
(
x for x in res.value if 'chat_read_mark_size_threshold' in x.key
)
)
).value.value
p(sre)
#Pyrogram
from pyrogram.raw.functions.help import GetAppConfig as g
client = userge
res = await client.send(g())
sre = (
next(
(
x for x in res.value if 'chat_read_mark_size_threshold' in x.key
)
)
).value.value
print(sre)
ℹ️ @UniBorg