async def get_pack_info(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): if not event.is_reply: await bot.update_message(event, PACKINFO_HELP) return rep_msg = await event.get_reply_message() if not rep_msg.document: await bot.update_message( event, "`Reply to a sticker to get the pack details`") return stickerset_attr = rep_msg.document.attributes[1] if not isinstance(stickerset_attr, DocumentAttributeSticker): await bot.update_message(event, "`Not a valid sticker`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = f"**Sticker Title:** `{get_stickerset.set.title}\n`" \ f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" \ f"**Official:** `{get_stickerset.set.official}`\n" \ f"**Archived:** `{get_stickerset.set.archived}`\n" \ f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" \ f"**Emojis In Pack:** {' '.join(pack_emojis)}" await event.edit(OUTPUT)
async def _(event): if event.fwd_from: return if not event.is_reply: await event.edit("Reply to any sticker to get it's pack info.") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("Reply to any sticker to get it's pack info.") return stickerset_attr_s = rep_msg.document.attributes stickerset_attr = find_instance(stickerset_attr_s, DocumentAttributeSticker) if not stickerset_attr.stickerset: await event.edit("sticker does not belong to a pack.") return get_stickerset = await borg( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) await event.edit( f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:** {' '.join(pack_emojis)}")
async def get_pack_info(event): if not event.is_reply: await event.edit("`I can't fetch info from nothing, can I ?!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("`Reply to a sticker to get the pack details`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit( "`Fetching details of the sticker pack, please wait..`") except BaseException: await event.edit("`This is not a sticker. Reply to a sticker.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`This is not a sticker. Reply to a sticker.`") return get_stickerset = await jbot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def process_message(context): reply_user_id = 0 link = process_link(context.chat_id, context.id) me = await context.client.get_me() try: reply = await context.get_reply_message() except ValueError: return try: reply_user_id = reply.sender.id if context.sticker: return if context.chat_id > 0: return except: pass try: config = yaml.load(open(r"./plugins/autoreplysticker/config.yml"), Loader=yaml.FullLoader) _sticker_id = int(config['sticker_id']) _sticker_hash = int(config['sticker_hash']) _num = config['num'] _time = int(config['time']) _whitelist = config['whitelist'] except: return try: if str(context.chat_id) in _whitelist: return if str(context.sender.id) in _whitelist: return if context.sender.bot: return except: pass if reply and reply_user_id == me.id: try: stickers = await context.client( GetStickerSetRequest(stickerset=InputStickerSetID( id=_sticker_id, access_hash=_sticker_hash))) except StickersetInvalidError: await log('配置错误。') return try: i = randint(0, len(_num) - 1) sticker = await context.client.send_file(context.chat_id, stickers.documents[int( _num[i])], reply_to=context.id) await sleep(_time) await sticker.delete() await log( f'#被回复\n在 [{context.chat.title}]({process_link(context.chat_id, context.id)})\n获得了 {get_name(context.sender)} 的回复' ) except: pass
async def get_pack_info(event): if not event.text[0].isalpha() and event.text[0] in ("."): if not event.is_reply: await event.edit("`I can't fetch info from nothing, can I ?!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("`Reply to a sticker to set a custom pack.`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Setting custom pack, please wait...`") except BaseException: await event.edit("`This is not a sticker. Reply to a sticker.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`This is not a sticker. Reply to a sticker.`") return get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) if get_stickerset.set.archived: await event.edit("`This pack is archived!`") return if len(get_stickerset.packs) == 120: await event.edit("`This pack is full!`") return async with event.client.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await event.client.send_read_acknowledge(conv.chat_id) await conv.send_message(get_stickerset.set.short_name) x = await conv.get_response() # Ensure user doesn't get spamming notifications await event.client.send_read_acknowledge(conv.chat_id) if "Invalid pack selected." in x.text: await event.edit("`You can't kang to others' packs!`") return open("pack", "w").write( f"{get_stickerset.set.title}\n{get_stickerset.set.short_name}") ur = f"[{get_stickerset.set.title}](t.me/addstickers/{get_stickerset.set.short_name})" await event.edit( f"Successfully changed kang pack to {ur}. New kanged stickers will be added there." )
async def stick(e): await e.delete() sticker_sets = await client(GetAllStickersRequest(0)) sticker_set = sticker_sets.sets[0] stickers =await client(GetStickerSetRequest( stickerset=InputStickerSetID( id=sticker_set.id, access_hash=sticker_set.access_hash ) )) await client.send_file(await client.get_input_entity(e.chat_id), stickers.documents[0])
async def get_sticker_set(c: TelegramClient, set_id: int, set_hash: int) -> StickerSet: if set_id in set_cache: return set_cache[set_id] result = await c(GetStickerSetRequest(InputStickerSetID(set_id, set_hash))) set_cache[set_id] = StickerSet( result.set.id, result.set.access_hash, result.set.title, result.set.short_name, result ) return set_cache[set_id]
async def _(event): approved_userss = approved_users.find({}) for ch in approved_userss: iid = ch["id"] userss = ch["user"] if event.is_group: if (await is_register_admin(event.input_chat, event.message.sender_id)): pass elif event.chat_id == iid and event.sender_id == userss: pass else: return if not event.is_reply: await event.reply("Reply to any sticker to get it's pack info.") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.reply("Reply to any sticker to get it's pack info.") return stickerset_attr_s = rep_msg.document.attributes stickerset_attr = find_instance( stickerset_attr_s, DocumentAttributeSticker) if not stickerset_attr.stickerset: await event.reply("sticker does not belong to a pack.") return get_stickerset = await tbot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) await event.reply( f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:** {' '.join(pack_emojis)}" )
async def run(self): async with TelegramClient('anon', api_id=self.settings.app_id, api_hash=self.settings.app_hash ) as client: # type: TelegramClient sticker_sets = await client(GetAllStickersRequest(0) ) # type: AllStickers stickers = [] for sticker_set in sticker_sets.sets: # type: StickerSet extracted_stickers = await client( GetStickerSetRequest(stickerset=InputStickerSetID( id=sticker_set.id, access_hash=sticker_set.access_hash))) stickers += extracted_stickers.documents await client.send_file(self.settings.login, random.choice(stickers))
async def _(e): x = await e.get_reply_message() if not (x and x.media and hasattr(x.media, "document")): return await eod(e, "`Reply To Sticker Only`") set = x.document.attributes[1] sset = await ultroid_bot( GetStickerSetRequest( InputStickerSetID( id=set.stickerset.id, access_hash=set.stickerset.access_hash, ))) pack = sset.set.short_name docs = [ utils.get_input_document(x) for x in (await bot( GetStickerSetRequest(InputStickerSetShortName(pack)))).documents ] for xx in docs: await e.respond(file=(xx))
async def get_pack_info(event): if not event.is_reply: await edit_delete( event, "**لا أستطيع إحضار المعلومات من لا شيء ، هل يمكنني ذلك ؟!**", 5 ) return rep_msg = await event.get_reply_message() if not rep_msg.document: await edit_delete(event, "**قم بالرد على الملصق للحصول على تفاصيل الحزمة**", 5) return try: stickerset_attr = rep_msg.document.attributes[1] icssevent = await edit_or_reply( event, "**جارٍ إحضار تفاصيل حزمة الملصقات ، يُرجى الانتظار ..**" ) except BaseException: await edit_delete(event, "**هذا ليس ملصقًا. الرد على ملصق.**", 5) return if not isinstance(stickerset_attr, DocumentAttributeSticker): await catevent.edit("**هذا ليس ملصقًا. الرد على ملصق.**") return get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"𓆰 𝑺𝑶𝑼𝑹𝑪𝑬 𝑱𝑀𝑇𝐻𝑂𝑁 - 𝑺𝑻𝑰𝑪𝑲𝑹𝑺 𝑰𝑵𝑭𝑶 𓆪\n" f"𓍹ⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧⵧ𓍻\n" f"⪼ **عنوان الملصق:** {get_stickerset.set.title}\n" f"⪼ **الاسم المختصر للملصق:** {get_stickerset.set.short_name}\n" # f"**المسؤول:** {get_stickerset.set.official}\n" # f"**المؤرشف:** {get_stickerset.set.archived}\n" f"⪼ **عدد الملصقات:** {get_stickerset.set.count}\n" f"⪼ **السمايلات المستخدمه:**\n{' '.join(pack_emojis)}" ) await icssevent.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: await event.edit("`Saya tidak bisa mengambil info dari nol!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("`Balas stiker untuk mendapatkan detail pack`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Mengambil detail pack stiker, harap tunggu..`") except BaseException: await event.edit("`INI BUKAN STIKER!. Balas stikernya.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`INI BUKAN STIKER!. Balas stikernya.`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"**Nama Stiker--------:** `{get_stickerset.set.title}\n`" f"**Nama Pendek Stiker-:** `{get_stickerset.set.short_name}`\n" f"**Official-----------:** `{get_stickerset.set.official}`\n" f"**Diarsipkan---------:** `{get_stickerset.set.archived}`\n" f"**Stiker di Pack-----:** `{len(get_stickerset.packs)}`\n" f"**Emoji di Pack------:**\n{' '.join(pack_emojis)}" ) await event.edit(OUTPUT)
def load_cache() -> None: global sticker_pack, current_vote, last_accepted try: with open(CACHE_FILE) as file: data = json.load(file) sp_data = data['sticker_pack'] if sp_data: sticker_pack = InputStickerSetID( id=sp_data['id'], access_hash=sp_data['access_hash']) cv_data = data['current_vote'] if cv_data: current_vote = cv_data current_vote['votes'] = { int(uid): VoteData(*data) for uid, data in cv_data['votes'].items() } last_accepted = data['last_accepted'] or 0 except OSError: pass
async def get_pack_info(event): if not event.is_reply: await event.edit("`Não consigo obter informações do nada, posso ?!`" ) return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit( "`Responda a um adesivo para obter os detalhes do pacote`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Buscando detalhes do pacote de adesivos, aguarde..`" ) except BaseException: await event.edit("`Isso não é um sticker. Responda em um adesivo.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`Isso não é um sticker. Responda em um adesivo.`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit( "`Mohon Balas Ke Sticker King`" ) rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit("`Balas ke sticker untuk melihat detail pack`") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Fetching details of the sticker pack, please wait..`") except BaseException: return await event.edit("`Ini bukan sticker, Mohon balas ke sticker.`") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit("`Ini bukan sticker, Mohon balas ke sticker.`") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Nama Pendek Sticker:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Arsip:** `{get_stickerset.set.archived}`\n" f"**Sticker Dalam Pack:** `{len(get_stickerset.packs)}`\n" f"**Emoji Dalam Pack:**\n{' '.join(pack_emojis)}" ) await event.edit(OUTPUT)
async def create_sticker_pack( bot: TelegramClient, item: InputStickerSetItem) -> Tuple[bool, Optional[StickerSet]]: try: stickerset: StickerSet = await bot( GetStickerSetRequest( InputStickerSetShortName(STICKER_PACK_SHORT_NAME))) created = False except StickersetInvalidError: stickerset: StickerSet = await bot( CreateStickerSetRequest(user_id=ADMIN_USER_ID, title=STICKER_PACK_TITLE, short_name=STICKER_PACK_SHORT_NAME, stickers=[item])) created = True global sticker_pack sticker_pack = InputStickerSetID(id=stickerset.set.id, access_hash=stickerset.set.access_hash) save_cache() return created, stickerset
async def get_pack_info(event): if not event.is_reply: await event.edit("`Non posso prendere le informazioni dal nulla...`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("`Rispondi ad uno sticker per avere le informazioni`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Sto prendendo le informazioni, aspetta...`") except BaseException: await event.edit("`Questo non è uno sticker. Rispondi ad uno sticker.`" ) return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`Questo non è uno sticker. Rispondi ad uno sticker.`" ) return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = f"**Titolo:** `{get_stickerset.set.title}\n`" \ f"**shortname:** `{get_stickerset.set.short_name}`\n" \ f"**Ufficiale:** `{get_stickerset.set.official}`\n" \ f"**Archiviato:** `{get_stickerset.set.archived}`\n" \ f"**Sticker nel pacco:** `{len(get_stickerset.packs)}`\n" \ f"**Emoji nel pacco:**\n{' '.join(pack_emojis)}" await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit( "**Não consigo obter informações do nada, posso?**") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit( "**Responda a um sticker para obter os detalhes do pacote.**") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit( "**Buscando detalhes do pacote de stickers, aguarde...**") except BaseException: return await event.edit( "**Este não é um sticker. Responda a um sticker.**") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit( "**Isto não é um sticker. Responda a um sticker.**") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Título do sticker:** `{get_stickerset.set.title}\n`" f"**Nome curto do sticker:** `{get_stickerset.set.short_name}`\n" f"**Oficial:** `{get_stickerset.set.official}`\n" f"**Arquivado:** `{get_stickerset.set.archived}`\n" f"**Stickers no pacote:** `{len(get_stickerset.packs)}`\n" f"**Emojis no pacote:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def dizbilgisi(event): if not event.is_reply: await event.edit( "`Hiçlikten bir bilgi çekemem, sence yapabilir miyim?!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit( "`Paket detaylarını görmek için bir çıkartmayı yanıtlayın`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Bu paketten detaylar alınıyor, lütfen bekleyin..`") except BaseException: await event.edit("`Bu bir çıkartma değil. Bir çıkartmayı yanıtlayın.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`Bu bir çıkartma değil. Bir çıkartmayı yanıtlayın.`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = f"**Sticker başlığı:** `{get_stickerset.set.title}\n`" \ f"**Sticker kısa adı:** `{get_stickerset.set.short_name}`\n" \ f"**Resmi mi:** `{get_stickerset.set.official}`\n" \ f"**Arşivlenmiş mi:** `{get_stickerset.set.archived}`\n" \ f"**Paketteki çıkartma sayısı:** `{len(get_stickerset.packs)}`\n" \ f"**Paketteki emoji sayısı:**\n{' '.join(pack_emojis)}" await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit("`Saya tidak bisa mengambil info dari nol, bukan ?!`") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit("`Balas stiker untuk mendapatkan detail paket`") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Mengambil detail paket stiker.\nTunggu sebentar...`") except BaseException: return await event.edit("`Ini bukan stiker! Balas stiker.`") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit("`Ini bukan stiker! Balas stiker.`") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ) ) ) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"**Judul Stiker** : `{get_stickerset.set.title}\n`" f"**Nama Stiker** : `{get_stickerset.set.short_name}`\n" f"**Resmi** : `{get_stickerset.set.official}`\n" f"**Diarsipkan** : `{get_stickerset.set.archived}`\n" f"**Stiker dalam Paket** : `{len(get_stickerset.packs)}`\n" f"**Emoji dalam Paket** :\n{' '.join(pack_emojis)}" ) await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit( "`Heç birşey haqqında məlumat verə bilmərəm :/`") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit( "`Yalnız stickerlər haqqında məlumat verə bilirəm...`") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Məlumatlar gətirilir...`") except BaseException: return await event.edit( "`Bu bir sticker deyil. Bir stickerə cavab verin`") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit( "`Bu bir sticker deyil. Bir stickerə cavab verin`") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"**Paket Başlığı:** `{get_stickerset.set.title}\n`" f"**Paketin Qısa adı:** `{get_stickerset.set.short_name}`\n" f"**Rəsmi:** `{get_stickerset.set.official}`\n" f"**Arxiv:** `{get_stickerset.set.archived}`\n" f"**Paketdəki emojili sticker sayı:** `{len(get_stickerset.packs)}`\n" f"**Paketdəki emojilər:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit("**Mohon Balas Ke Sticker**") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit( "**Balas ke sticker untuk melihat detail pack**") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Processing...`") except BaseException: return await event.edit( "**Ini bukan sticker, Mohon balas ke sticker.**") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit( "**Ini bukan sticker, Mohon balas ke sticker.**") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = ( f"âž **Nama Sticker:** [{get_stickerset.set.title}](http://t.me/addstickers/{get_stickerset.set.short_name})\n" f"âž **Official:** `{get_stickerset.set.official}`\n" f"âž **Arsip:** `{get_stickerset.set.archived}`\n" f"âž **Sticker Dalam Pack:** `{len(get_stickerset.packs)}`\n" f"âž **Emoji Dalam Pack:** {' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: await event.edit("`Aku Tidak Mendapatkan Informasi!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit("`Reply Stiker Untuk Mendapatkan Detail`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Membuat Detai Pack, Mohon Bersabar..`") except BaseException: await event.edit("`Ini Bukan Stiker. Reply Ke Stiker.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`Ini Bukan Stiker. Reply Ke Stiker.`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = f"**Sticker Title:** `{get_stickerset.set.title}\n`" \ f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" \ f"**Official:** `{get_stickerset.set.official}`\n" \ f"**Archived:** `{get_stickerset.set.archived}`\n" \ f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" \ f"**Emojis In Pack:**\n{' '.join(pack_emojis)}" await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: await edit_delete(event, "`I can't fetch info from nothing, can I ?!`", 5) return rep_msg = await event.get_reply_message() if not rep_msg.document: await edit_delete(event, "`Reply to a sticker to get the pack details`", 5) return try: stickerset_attr = rep_msg.document.attributes[1] catevent = await edit_or_reply( event, "`Fetching details of the sticker pack, please wait..`") except BaseException: await edit_delete(event, "`This is not a sticker. Reply to a sticker.`", 5) return if not isinstance(stickerset_attr, DocumentAttributeSticker): await catevent.edit("`This is not a sticker. Reply to a sticker.`") return get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Judul stiker:** `{get_stickerset.set.title}\n`" f"**Nama Pendek Stiker:** `{get_stickerset.set.short_name}`\n" f"**Resmi:** `{get_stickerset.set.official}`\n" f"**Diarsipkan:** `{get_stickerset.set.archived}`\n" f"**Stiker Dalam Kemasan:** `{len(get_stickerset.packs)}`\n" f"**Emoji Dalam Paket:**\n{' '.join(pack_emojis)}") await catevent.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit( "`Saya tidak dapat mengambil info dari ketiadaan, bukan??!`") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit( "`Membalas stiker untuk mendapatkan detail paket`") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit("`Mengambil detail dari paket stiker, harap tunggu..`" ) except BaseException: return await event.edit("`Ini bukan stiker. Membalas ke stiker.`") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit("`Ini bukan stiker. Membalas ke stiker.`") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: return await event.edit( "`Aku tidak bisa mengambil info dari apapun, bisakah aku?!`") rep_msg = await event.get_reply_message() if not rep_msg.document: return await event.edit("`Balas ke sticker untuk melihat detail pack`") try: stickerset_attr = rep_msg.document.attributes[1] await event.edit( "`Fetching details of the sticker pack, please wait..`") except BaseException: return await event.edit("`Balas ke sticker anjenggg.`") if not isinstance(stickerset_attr, DocumentAttributeSticker): return await event.edit("`Balas ke sticker anjenggg.`") get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def get_pack_info(event): if not event.is_reply: await event.edit("`Hiçbir şeyden bilgi alamıyorum, değil mi?!`") return rep_msg = await event.get_reply_message() if not rep_msg.document: await event.edit( "`Paket ayrıntılarını almak için bir çıkartmayı yanıtlayın`") return try: stickerset_attr = rep_msg.document.attributes[1] await event.edit( "`Çıkartma paketinin ayrıntıları alınıyor, lütfen bekleyin..`") except BaseException: await event.edit("`Bu bir çıkartma değil. Bir çıkartmayı yanıtlayın.`") return if not isinstance(stickerset_attr, DocumentAttributeSticker): await event.edit("`Bu bir çıkartma değil. Bir çıkartmayı yanıtlayın.`") return get_stickerset = await bot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) pack_emojis = [] for document_sticker in get_stickerset.packs: if document_sticker.emoticon not in pack_emojis: pack_emojis.append(document_sticker.emoticon) OUTPUT = (f"**Sticker Title:** `{get_stickerset.set.title}\n`" f"**Sticker Short Name:** `{get_stickerset.set.short_name}`\n" f"**Official:** `{get_stickerset.set.official}`\n" f"**Archived:** `{get_stickerset.set.archived}`\n" f"**Stickers In Pack:** `{len(get_stickerset.packs)}`\n" f"**Emojis In Pack:**\n{' '.join(pack_emojis)}") await event.edit(OUTPUT)
async def _(event): try: if not event.is_reply: await event.reply( "Reply to a sticker to remove it from your personal sticker pack." ) return reply_message = await event.get_reply_message() kanga = await event.reply("`Deleting .`") if not is_message_image(reply_message): await kanga.edit("Please reply to a sticker.") return rmsticker = await ubot.get_messages(event.chat_id, ids=reply_message.id) stickerset_attr_s = reply_message.document.attributes stickerset_attr = find_instance(stickerset_attr_s, DocumentAttributeSticker) if not stickerset_attr.stickerset: await event.reply("Sticker does not belong to a pack.") return get_stickerset = await tbot( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) packname = get_stickerset.set.short_name sresult = (await ubot( functions.messages.GetStickerSetRequest( InputStickerSetShortName(packname)))).documents for c in sresult: if int(c.id) != int(stickerset_attr.stickerset.id): await kanga.edit( "This sticker is already removed from your personal sticker pack." ) return await kanga.edit("`Deleting ..`") async with ubot.conversation("@Stickers") as bot_conv: await silently_send_message(bot_conv, "/cancel") response = await silently_send_message(bot_conv, "/delsticker") if "Choose" not in response.text: await tbot.edit_message( kanga, f"**FAILED**! @Stickers replied: {response.text}") return response = await silently_send_message(bot_conv, packname) if not response.text.startswith("Please"): await tbot.edit_message( kanga, f"**FAILED**! @Stickers replied: {response.text}") return try: await rmsticker.forward_to("@Stickers") except Exception as e: print(e) if response.text.startswith("This pack has only"): await silently_send_message(bot_conv, "Delete anyway") await kanga.edit("`Deleting ...`") response = await bot_conv.get_response() if "I have deleted" not in response.text: await tbot.edit_message( kanga, f"**FAILED**! @Stickers replied: {response.text}") return await kanga.edit( "Successfully deleted that sticker from your personal pack.") except Exception as e: os.remove("sticker.webp") print(e)
async def kangpack(event): await event.edit("`Kanging the whole pack...`") user = await bot.get_me() pack_username = "" if not user.username: try: user.first_name.decode("ascii") pack_username = user.first_name except UnicodeDecodeError: # User's first name isn't ASCII, use ID instead pack_username = user.id else: pack_username = user.username textx = await event.get_reply_message() if not textx.sticker: await event.edit( "`You need to reply to a sticker to be able to kang the whole pack!`" ) return sticker_set = textx.file.sticker_set stickers = await event.client( GetStickerSetRequest(stickerset=InputStickerSetID( id=sticker_set.id, access_hash=sticker_set.access_hash))) is_anim = textx.file.mime_type == "application/x-tgsticker" number = event.pattern_match.group(2) or 1 new_pack = False while not new_pack: packname = f"a{user.id}_by_{pack_username}_{number}{'_anim' if is_anim else ''}" packtitle = (f"@{user.username or user.first_name}'s Paperplane Pack " f"{number}{' animated' if is_anim else ''}") response = urllib.request.urlopen( urllib.request.Request(f"http://t.me/addstickers/{packname}")) htmlstr = response.read().decode("utf8").split("\n") new_pack = PACK_DOESNT_EXIST in htmlstr if not new_pack: if event.pattern_match.group(2): await event.edit( "`This pack doesn't exist! Specify another number or omit the argument to let " "Paperplane get the lowest available pack number automatically.`" ) return number += 1 # Mute Stickers bot to ensure user doesn't get notification spam muted = await bot( UpdateNotifySettingsRequest( peer="t.me/Stickers", settings=InputPeerNotifySettings(mute_until=2**31 - 1), ) # Mute forever ) if not muted: # Tell the user just in case, this may rarely happen await event.edit( "`Paperplane couldn't mute the Stickers bot, beware of notification spam.`" ) async with bot.conversation("Stickers") as conv: # Cancel any pending command await conv.send_message("/cancel") await conv.get_response() # Send new pack command if is_anim: await conv.send_message("/newanimated") else: await conv.send_message("/newpack") await conv.get_response() # Give the pack a name await conv.send_message(packtitle) await conv.get_response() for sticker in stickers.documents: async with bot.conversation("Stickers") as conv2: emoji = sticker.attributes[1].alt # Upload sticker file if is_anim: sticker_dl = io.BytesIO() await bot.download_media(sticker, sticker_dl) sticker_dl.seek(0) upload = await bot.upload_file(sticker_dl, file_name="AnimatedSticker.tgs") await conv2.send_file(upload, force_document=True) else: await conv2.send_file(sticker, force_document=True) await conv2.get_response() # Send the emoji await conv2.send_message(emoji) await conv2.get_response() async with bot.conversation("Stickers") as conv: # Publish the pack await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packtitle}>") await conv.get_response() # Skip pack icon selection await conv.send_message("/skip") await conv.get_response() # Send packname await conv.send_message(packname) await conv.get_response() # Read all unread messages await bot.send_read_acknowledge("t.me/Stickers") # Unmute Stickers bot back muted = await bot( UpdateNotifySettingsRequest( peer="t.me/Stickers", settings=InputPeerNotifySettings(mute_until=None))) await event.edit( f"`Sticker pack {number}{' (animated)' if is_anim else ''} has been created!\n" f"It can be found` [here](t.me/addstickers/{packname})`.`", parse_mode="md", )
async def pack_kang(event): if event.fwd_from: return user = await event.client.get_me() if user.username: username = user.username else: try: user.first_name.encode("utf-8").decode("ascii") username = user.first_name except UnicodeDecodeError: username = f"cat_{user.id}" photo = None userid = user.id is_anim = False emoji = None reply = await event.get_reply_message() cat = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") if not reply or media_type(reply) is None or media_type( reply) != "Sticker": return await edit_delete( event, "`reply to any sticker to send all stickers in that pack`") try: stickerset_attr = reply.document.attributes[1] catevent = await edit_or_reply( event, "`Fetching details of the sticker pack, please wait..`") except BaseException: return await edit_delete( event, "`This is not a sticker. Reply to a sticker.`", 5) try: get_stickerset = await event.client( GetStickerSetRequest( InputStickerSetID( id=stickerset_attr.stickerset.id, access_hash=stickerset_attr.stickerset.access_hash, ))) except: return await edit_delete( catevent, "`I guess this sticker is not part of any pack. So, i cant kang this sticker pack try kang for this sticker`", ) kangst = 1 reqd_sticker_set = await event.client( functions.messages.GetStickerSetRequest( stickerset=types.InputStickerSetShortName( short_name=f"{get_stickerset.set.short_name}"))) noofst = get_stickerset.set.count blablapacks = [] blablapacknames = [] pack = None for message in reqd_sticker_set.documents: if "image" in message.mime_type.split("/"): await edit_or_reply( catevent, f"`This sticker pack is kanging now . Status of kang process : {kangst}/{noofst}`", ) photo = io.BytesIO() await event.client.download_file(message, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.attributes): emoji = message.attributes[1].alt elif "tgsticker" in message.mime_type: await edit_or_reply( catevent, f"`This sticker pack is kanging now . Status of kang process : {kangst}/{noofst}`", ) await event.client.download_file(message, "AnimatedSticker.tgs") attributes = message.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt is_anim = True photo = 1 else: await edit_delete(catevent, "`Unsupported File!`") return if photo: splat = ("".join(event.text.split(maxsplit=1)[1:])).split() emoji = emoji or "😂" if pack is None: pack = 1 if len(splat) == 1: pack = splat[0] elif len(splat) > 1: return await edit_delete( catevent, "`Sorry the given name cant be used for pack or there is no pack with that name`", ) try: cat = Get(cat) await event.client(cat) except BaseException: pass packnick = pack_nick(username, pack, is_anim) packname = pack_name(userid, pack, is_anim) cmd = "/newpack" stfile = io.BytesIO() if is_anim: cmd = "/newanimated" else: image = await resize_photo(photo) stfile.name = "sticker.png" image.save(stfile, "PNG") response = urllib.request.urlopen( urllib.request.Request(f"http://t.me/addstickers/{packname}")) htmlstr = response.read().decode("utf8").split("\n") if (" A <strong>Telegram</strong> user has created the <strong>Sticker Set</strong>." in htmlstr): async with event.client.conversation("Stickers") as conv: pack, catpackname = await newpacksticker( catevent, conv, cmd, event, pack, packnick, stfile, emoji, packname, is_anim, pkang=True, ) else: async with event.client.conversation("Stickers") as conv: pack, catpackname = await add_to_pack( catevent, conv, event, packname, pack, userid, username, is_anim, stfile, emoji, cmd, pkang=True, ) if catpackname not in blablapacks: blablapacks.append(catpackname) blablapacknames.append(pack) kangst += 1 await asyncio.sleep(2) result = "`This sticker pack is kanged into the following your sticker pack(s):`\n" for i in range(len(blablapacks)): result += f" • [pack {blablapacknames[i]}](t.me/addstickers/{blablapacks[i]})" await catevent.edit(result)