async def _(event): if event.fwd_from: return await event.edit("Starting a Mass-UnFedBan...") if event.reply_to_msg_id: previous_message = await event.get_reply_message() FBAN = previous_message.sender_id else: FBAN = event.pattern_match.group(1) if Config.FBAN_GROUP_ID: chat = Config.FBAN_GROUP_ID else: chat = await event.get_chat() fedList = [] for a in range(3): async with bot.conversation("@MissRose_bot") as bot_conv: await bot_conv.send_message("/start") await bot_conv.send_message("/myfeds") response = await bot_conv.get_response() if "make a file" in response.text: await asyncio.sleep(3) await response.click(0) fedfile = await bot_conv.get_response() if fedfile.media: downloaded_file_name = await bot.download_media( fedfile, "fedlist") file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: fedList.append(line[:line.index(":")]) else: return if len(fedList) == 0: await event.edit( f"Something went wrong. Retrying ({a+1}/3)...") else: break else: await event.edit(f"Error") if "You can only use fed commands once every 5 minutes" in response.text: await event.edit("Try again after 5 mins.") return In = False tempFedId = "" for x in response.text: if x == "`": if In: In = False fedList.append(tempFedId) tempFedId = "" else: In = True elif In: tempFedId += x await event.edit(f"UnFbaning in {len(fedList)} feds.") try: await bot.send_message(chat, f"/start") except BaseException: await event.edit("FBAN_GROUP_ID is incorrect.") return await asyncio.sleep(5) for fed in fedList: await bot.send_message(chat, f"/joinfed {fed}") await asyncio.sleep(5) await bot.send_message(chat, f"/unfban {FBAN}") await asyncio.sleep(5) await event.edit( f"SuperUnFBan Completed. Affected {len(fedList)} feds.\n#TB")
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ if not args.text[0].isalpha() and args.text[0] not in ("/", "#", "@", "!"): user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit( "Waiting for Global Warming to melt this pic into a sticker..." ) photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit("Using witchery to kang this sticker...") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit("Taming this animated sticker...") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("Unsupported File!") return else: await args.edit("I can't kang that...") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = "1" if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s kang pack Vol.{pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick = f"@{user.username}'s animated kang pack Vol.{pack}" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) await conv.get_response() if is_anim: await conv.send_file('AnimatedSticker.tgs', force_document=True) remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "Failed to add sticker,use @Stickers bot.") return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("Brewing a new Pack...") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs', force_document=True) remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "Failed to add sticker,use @Stickers bot.") return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Sticker kanged successfully! Pack can be found [here](t.me/addstickers/{packname})", parse_mode='md')
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split("/"): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.media.document.attributes): emoji = message.media.document.attributes[1].alt if emoji != "": emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, "AnimatedSticker.tgs") attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Unsupported File!`") return else: await args.edit( "`Couldn't download sticker! Make sure you send a proper sticker/photo.`" ) return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s remix pack Vol.{pack}" cmd = "/newpack" file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = "/newanimated" 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>." not in htmlstr): async with bot.conversation("Stickers") as conv: await conv.send_message("/addsticker") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s remix pack Vol.{pack}" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"`Sticker added in a Different Pack !\ \nThis Pack is Newly created!`\ \nYour pack can be found [here](t.me/addstickers/{packname})", parse_mode="md", ) return if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/done") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Brewing a new Pack...`") async with bot.conversation("Stickers") as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Buildbotted for you Senpai😋 `\ \nGently press [here](t.me/addstickers/{packname}) UwU", parse_mode='md') await asyncio.sleep(7.5) await args.delete()
async def mim(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit("**Syntax:** reply to an image with `.mmf 'text on top' ; 'text on bottom'` ") return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit("`reply to a image/sticker/gif`") return chat = "@MemeAutobot" sender = reply_message.sender file_ext_ns_ion = "@memetime.png" file = await bot.download_file(reply_message.media) uploaded_gif = None if reply_message.sender.bot: await event.edit("`Reply to actual users message.`") return else: await event.edit("`Transfiguration Time! Mwahaha Memifying this image! (」゚ロ゚)」 `") await asyncio.sleep(5) async with bot.conversation("@MemeAutobot") as bot_conv: try: memeVar = event.pattern_match.group(1) await silently_send_message(bot_conv, "/start") await asyncio.sleep(1) await silently_send_message(bot_conv, memeVar) await bot.send_file(chat, reply_message.media) response = await bot_conv.get_response() except YouBlockedUserError: await event.reply("Please unblock @MemeAutobot and try again") return if response.text.startswith("Forward"): await event.edit("`can you kindly disable your forward privacy settings for good, Nibba?`") if "Okay..." in response.text: await event.edit("`🛑 🤨 NANI?! This is not an image! This will take sum tym to convert to image... UwU 🧐 🛑`") input_str = event.pattern_match.group(1) if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY): os.makedirs(TEMP_DOWNLOAD_DIRECTORY) if event.reply_to_msg_id: file_name = "meme.png" reply_message = await event.get_reply_message() to_download_directory = TEMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, file_name) downloaded_file_name = await bot.download_media( reply_message, downloaded_file_name, ) if os.path.exists(downloaded_file_name): await bot.send_file( chat, downloaded_file_name, force_document=False, supports_streaming=False, allow_cache=False, ) os.remove(downloaded_file_name) else: await event.edit("File Not Found {}".format(input_str)) response = await bot_conv.get_response() the_download_directory = TEMP_DOWNLOAD_DIRECTORY files_name = "memes.webp" download_file_name = os.path.join(the_download_directory, files_name) await bot.download_media( response.media, download_file_name, ) requires_file_name = TEMP_DOWNLOAD_DIRECTORY + "memes.webp" await bot.send_file( # pylint:disable=E0602 event.chat_id, requires_file_name, supports_streaming=False, caption="Memifyed", ) await event.delete() elif not is_message_image(reply_message): await event.edit("Invalid message type. Plz choose right message type u NIBBA.") return else: await bot.send_file(event.chat_id, response.media)
async def kang(args): user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split("/"): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.media.document.attributes): emoji = message.media.document.attributes[1].alt if emoji != "👑": emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, "AnimatedSticker.tgs") attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: return await args.edit("`File Tidak Didukung Alpha!`") else: return await args.edit( "`Maaf Alpha, Saya Gagal Mengambil Sticker Ini!`") if photo: splat = args.text.split() if not emojibypass: emoji = "👑" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] u_name = user.username f_name = user.first_name packname = f"StickerBy{u_name}_{pack}" custom_packnick = f"{custompack}" or f"{f_name}" packnick = f"{custom_packnick}" cmd = "/newpack" file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = "/newanimated" 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>." not in htmlstr): async with bot.conversation("Stickers") as conv: await conv.send_message("/addsticker") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"StickerBy{u_name}_{pack}" packnick = f"{custom_packnick}" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Gagal Memilih Pack.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) return await args.edit( "`Sticker ditambahkan ke pack yang berbeda !" "\nIni pack yang baru saja Lord buat!" f"\nTekan [Alpha Pack](t.me/addstickers/{packname}) Untuk Melihat Sticker Alpha", parse_mode="md", ) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: return await args.edit( "`Maaf Alpha, Saya Gagal Menambahkan Sticker, Gunakan` @Stickers ` Bot Untuk Menambahkan Sticker Anda.`" ) await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/done") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Membuat Pack Sticker Baru`") async with bot.conversation("Stickers") as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: return await args.edit( "`Mohon Maaf Alpha, Saya Gagal Menambahkan Sticker, Gunakan` @Stickers ` Bot Untuk Menambahkan Sticker.`" ) await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"**Berhasil Menambahkan Sticker Ke Pack, Tekan** **[Alpha Pack](t.me/addstickers/{packname})** **Untuk Melihat Pack Anda**", parse_mode="md", )
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ if not args.text[0].isalpha() and args.text[0] not in ("/", "#", "@", "!"): user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("Unsupported File!") return else: await args.edit("I can't kang that...") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username} Sabertooth Ngentot{pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username} Sabertooth Ngentot{pack}" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Sticker added in a Different Pack! This Pack is Newly created! Your pack can be found [lihat disini](t.me/addstickers/{packname})", parse_mode='md') return if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "Failed to add sticker, use @Stickers bot to add the sticker manually." ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("Brewing a new Pack...") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "Failed to add sticker, use @Stickers bot to add the sticker manually." ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Sticker Berhasil Dicury/Successfully stolen! [lihat disini](t.me/addstickers/{packname})", parse_mode='md')
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ if not args.text[0].isalpha() and args.text[0] not in ("/", "#", "@", "!"): user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = "" if message and message.media: if isinstance(message.media, MessageMediaPhoto): photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif (DocumentAttributeFilename(file_name='AnimatedSticker.tgs') in message.media.document.attributes): emoji = message.media.document.attributes[0].alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Unsupported File!`") return else: await args.edit("`Reply to photo to kang it bruh`") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = "1" if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s userbot pack {pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " animated" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) await conv.get_response() if is_anim: await bot.forward_messages('Stickers', [message.id], args.chat_id) else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("Userbot sticker pack \ doesn't exist! Making a new one!") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await bot.forward_messages('Stickers', [message.id], args.chat_id) else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Sticker added! Your pack can be found [here](t.me/addstickers/{packname})", parse_mode='md')
async def _(event): if event.fwd_from: return await event.edit(f"**STARTING 𝙳𝙴𝚅𝙸𝙻 UNFBANNING BY {PRO}**...") if event.reply_to_msg_id: previous_message = await event.get_reply_message() FBAN = previous_message.sender_id else: FBAN = event.pattern_match.group(1) if Config.FBAN_GROUP_ID: chat = Config.FBAN_GROUP_ID else: chat = await event.get_chat() fedList = [] for a in range(3): async with bot.conversation("@MissRose_bot") as bot_conv: await bot_conv.send_message("/start") await bot_conv.send_message("/myfeds") response = await bot_conv.get_response() if "make a file" in response.text: await asyncio.sleep(3) await response.click(0) fedfile = await bot_conv.get_response() if fedfile.media: downloaded_file_name = await bot.download_media( fedfile, "fedlist") file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: fedList.append(line[:line.index(":")]) else: return if len(fedList) == 0: await event.edit( f"FINDING {PRO} ALL FEDS GIVE ME SOME TIME({a+1}/3)..." ) else: break else: await event.edit(f"Error") if "You can only use fed commands once every 5 minutes" in response.text: await event.edit("Try again after 5 mins.") return In = False tempFedId = "" for x in response.text: if x == "`": if In: In = False fedList.append(tempFedId) tempFedId = "" else: In = True elif In: tempFedId += x await event.edit(f"UNFBANNING IN {len(fedList)} FEDS BY {PRO}.") try: await bot.send_message(chat, f"/start") except BaseException: await event.edit("FBAN_GROUP_ID is incorrect.") return await asyncio.sleep(5) for fed in fedList: await bot.send_message(chat, f"/joinfed {fed}") await asyncio.sleep(5) await bot.send_message(chat, f"/unfban {FBAN}") await asyncio.sleep(5) await event.edit( f"𝙳𝚎𝚟𝚒𝚕UnFBan Completed. Affected {len(fedList)} Feds by {PRO}.\n#DARKLONBOT" )
async def mim(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit( "`Syntax: reply to an image with .mmf` 'text on top' ; 'text on bottom' " ) return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit("```reply to a image/sticker/gif```") return chat = "@MemeAutobot" sender = reply_message.sender file_ext_ns_ion = "@memetime.png" file = await bot.download_file(reply_message.media) uploaded_gif = None if reply_message.sender.bot: await event.edit("```Reply to actual users message.```") return else: await event.delete() await asyncio.sleep(5) async with bot.conversation("@MemeAutobot") as bot_conv: try: memeVar = event.pattern_match.group(1) await silently_send_message(bot_conv, "/start") await asyncio.sleep(1) await silently_send_message(bot_conv, memeVar) await bot.send_file(chat, reply_message.media) response = await bot_conv.get_response() except YouBlockedUserError: await event.reply("```Please unblock @MemeAutobot and try again```" ) return if response.text.startswith("Forward"): await event.edit("```Failed due to privacy```") if "Okay..." in response.text: await event.edit("```This is not an image!```") thumb = None if os.path.exists(THUMB_IMAGE_PATH): thumb = THUMB_IMAGE_PATH input_str = event.pattern_match.group(1) if not os.path.isdir(TEMP_DOWNLOAD_DIRECTORY): os.makedirs(TEMP_DOWNLOAD_DIRECTORY) if event.reply_to_msg_id: file_name = "meme.png" reply_message = await event.get_reply_message() to_download_directory = TEMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, file_name) downloaded_file_name = await bot.download_media( reply_message, downloaded_file_name, ) if os.path.exists(downloaded_file_name): await bot.send_file( chat, downloaded_file_name, force_document=False, supports_streaming=False, allow_cache=False, thumb=thumb, ) os.remove(downloaded_file_name) else: await event.edit("File Not Found {}".format(input_str)) response = await bot_conv.get_response() the_download_directory = TEMP_DOWNLOAD_DIRECTORY files_name = "memes.webp" download_file_name = os.path.join(the_download_directory, files_name) await bot.download_media( response.media, download_file_name, ) requires_file_name = TEMP_DOWNLOAD_DIRECTORY + "memes.webp" await bot.send_file( # pylint:disable=E0602 event.chat_id, requires_file_name, supports_streaming=False, caption="Memifyed", ) await event.delete() #await bot.send_message(event.chat_id, "`☠️☠️Ah Shit... Here we go Again!🔥🔥`") elif not is_message_image(reply_message): await event.edit("Invalid message type.") return else: await bot.send_file(event.chat_id, response.media)
async def _(event): if event.fwd_from: return await event.edit(f"**STARTING LEGENDS BAN BY {PRO}**...") fedList = [] if event.reply_to_msg_id: previous_message = await event.get_reply_message() if previous_message.media: downloaded_file_name = await bot.download_media(previous_message, "fedlist") await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #LEGENDS FBANNED🔥 " else: FBAN = previous_message.sender_id REASON = event.text.split(" ", maxsplit=1)[1] if REASON.strip() == "": REASON = " #LEGENDS FBANNED 🔥" else: arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #LEGENDS FBANNED 🔥 " try: int(FBAN) if int(FBAN) == 1281934570 or int(FBAN) == 1100231654: await event.edit("BHAAG BETICHOD APNE BAAP KO FBAN DEGA") return except BaseException: if FBAN == "@PROBOY22" or FBAN == "@LEGENDX22": await event.edit("NIKAL LAWDE TUJHE HI SUPER FBAN KRRAHAHU.") return if Config.FBAN_GROUP_ID: chat = Config.FBAN_GROUP_ID else: chat = await event.get_chat() if not len(fedList): for a in range(3): async with bot.conversation("@MissRose_bot") as bot_conv: await bot_conv.send_message("/start") await bot_conv.send_message("/myfeds") await asyncio.sleep(3) response = await bot_conv.get_response() await asyncio.sleep(3) if "make a file" in response.text: await asyncio.sleep(6) await response.click(0) await asyncio.sleep(6) fedfile = await bot_conv.get_response() await asyncio.sleep(3) if fedfile.media: downloaded_file_name = await bot.download_media( fedfile, "fedlist" ) await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass else: return if len(fedList) == 0: await event.edit( f"WAIT MASTER I AM CHECKING {PRO} ALL FEDS GIVE ME TIME ({a+1}/3)..." ) else: break else: await event.edit(f"Error") if "You can only use fed commands once every 5 minutes" in response.text: await event.edit("Try again after 5 mins.") return In = False tempFedId = "" for x in response.text: if x == "`": if In: In = False fedList.append(tempFedId) tempFedId = "" else: In = True elif In: tempFedId += x if len(fedList) == 0: await event.edit("Something went wrong.") return await event.edit(f"FBANNING IN {len(fedList)} BY {PRO} 🔥.") try: await bot.send_message(chat, f"/start") except BaseException: await event.edit("FBAN_GROUP_ID is incorrect.") return await asyncio.sleep(3) if Config.EXCLUDE_FED: excludeFed = Config.EXCLUDE_FED.split("|") for n in range(len(excludeFed)): excludeFed[n] = excludeFed[n].strip() exCount = 0 for fed in fedList: if Config.EXCLUDE_FED and fed in excludeFed: await bot.send_message(chat, f"{fed} Excluded.") exCount += 1 continue await bot.send_message(chat, f"/joinfed {fed}") await asyncio.sleep(3) await bot.send_message(chat, f"/fban {FBAN} {REASON}") await asyncio.sleep(3) await event.edit( f"SuperFBan Completed. Affected {len(fedList) - exCount} feds.\n#LEGEND BOT" )
async def _(event): if event.fwd_from: return await event.edit(f"**𝚂𝚝𝚊𝚛𝚝𝚒𝚗𝚐 𝙳𝚎𝚟𝚒𝚕𝙵𝚋𝚊𝚗 𝙱𝚢 {PRO}**...") fedList = [] if event.reply_to_msg_id: previous_message = await event.get_reply_message() if previous_message.media: downloaded_file_name = await bot.download_media( previous_message, "fedlist") await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #DARKLONFBANNED 🔥 " else: FBAN = previous_message.sender_id REASON = event.text.split(" ", maxsplit=1)[1] if REASON.strip() == "": REASON = " #DARKLONFBANNED 🔥" else: arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #DARKLONFBANNED 🔥 " try: int(FBAN) if int(FBAN) == 1513257955 or int(FBAN) == 1037581197: await event.edit("BHAAG BETICHOD APNE BAAP KO FBAN DEGA") return except BaseException: if FBAN == "@lucifermorningstarbackup" or FBAN == "@luciifeermorningstar": await event.edit("NIKAL LAWDE TUJHE HI SUPER FBAN KRRAHAHU.") return if Config.FBAN_GROUP_ID: chat = Config.FBAN_GROUP_ID else: chat = await event.get_chat() if not len(fedList): for a in range(3): async with bot.conversation("@MissRose_bot") as bot_conv: await bot_conv.send_message("/start") await bot_conv.send_message("/myfeds") await asyncio.sleep(3) response = await bot_conv.get_response() await asyncio.sleep(3) if "make a file" in response.text: await asyncio.sleep(6) await response.click(0) await asyncio.sleep(6) fedfile = await bot_conv.get_response() await asyncio.sleep(3) if fedfile.media: downloaded_file_name = await bot.download_media( fedfile, "fedlist") await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass else: return if len(fedList) == 0: await event.edit( f"𝚠𝚊𝚒𝚝 𝙼𝙰𝚂𝚃𝙴𝚁 𝙸 𝙰𝙼 𝙲𝙷𝙴𝙲𝙺𝙸𝙽𝙶 {PRO} 𝙰𝙻𝙻 𝙵𝙴𝙳𝚂 𝙶𝙸𝚅𝙴 𝙼𝙴 𝚃𝙸𝙼𝙴 ({a+1}/3)..." ) else: break else: await event.edit(f"Error") if "You can only use fed commands once every 5 minutes" in response.text: await event.edit("Try again after 5 mins.") return In = False tempFedId = "" for x in response.text: if x == "`": if In: In = False fedList.append(tempFedId) tempFedId = "" else: In = True elif In: tempFedId += x if len(fedList) == 0: await event.edit("Something went wrong.") return await event.edit(f"𝙳𝚎𝚟𝚒𝚕𝚏𝚋𝚊𝚗𝚗𝚒𝚗𝚐 IN {len(fedList)} BY {PRO} 🔥.") try: await bot.send_message(chat, f"/start") except BaseException: await event.edit("FBAN_GROUP_ID is incorrect.") return await asyncio.sleep(3) if Config.EXCLUDE_FED: excludeFed = Config.EXCLUDE_FED.split("|") for n in range(len(excludeFed)): excludeFed[n] = excludeFed[n].strip() exCount = 0 for fed in fedList: if Config.EXCLUDE_FED and fed in excludeFed: await bot.send_message(chat, f"{fed} Excluded.") exCount += 1 continue await bot.send_message(chat, f"/joinfed {fed}") await asyncio.sleep(3) await bot.send_message(chat, f"/fban {FBAN} {REASON}") await asyncio.sleep(3) await event.edit( f"SuperFBan Completed. Affected {len(fedList) - exCount} feds.\n#DARKLON BOT" )
async def colong(args): """ For .kang command, kangs stickers or creates new ones. """ user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`File e Ora Support!`") return else: await args.edit("`aku ga iso nyolong kang...`") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s pack Vol.{pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s pack Vol.{pack}" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Stickermu nang pack liyane !\ \nIki Pack Sticker Nyarmu!\ \nNyo Link e [here](t.me/addstickers/{packname})", parse_mode='md') return if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Nggawe Pack Nyar...`") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`sԵíckҽɾ ճҽɾհαsíl ժí cօlօղց ^_^!`\ \nNyo Pack sing nyar [terbaru](t.me/addstickers/{packname})", parse_mode='md')
async def fedban_all(msg): if not is_mongo_alive(): await msg.edit("`Database connections failing!`") return reply_message = await msg.get_reply_message() params = msg.pattern_match.group(1) or "" args, text = parse_arguments(params, ['reason']) banid = None if reply_message: banid = reply_message.from_id banreason = args.get('reason', '[spam]') else: banreason = args.get('reason', '[fban]') if text.isnumeric(): banid = int(text) elif msg.message.entities: ent = await bot.get_entity(text) if ent: banid = ent.id if "[spam]" in banreason: spamwatch = True else: spamwatch = False # Send the proof to Spamwatch in case it was spam # Spamwatch is a reputed fed fighting against spam on telegram if spamwatch: if reply_message: await reply_message.forward_to(-1001312712379) if not banid: return await msg.edit("**No user to fban**") failed = dict() count = 1 fbanlist = [i['chat_id'] for i in await get_fban()] for bangroup in fbanlist: async with bot.conversation(bangroup) as conv: await conv.send_message(f"/fban {banid} {banreason}") resp = await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) if "New FedBan" not in resp.text: failed[bangroup] = str(conv.chat_id) else: count += 1 await msg.reply("**Fbanned in " + str(count) + " feds!**") # Sleep to avoid a floodwait. # Prevents floodwait if user is a fedadmin on too many feds await asyncio.sleep(0.2) if failed: failedstr = "" for i in failed.keys(): failedstr += failed[i] failedstr += " " await msg.reply(f"`Failed to fban in {failedstr}`") else: await msg.reply("`Fbanned in all feds!`") await sleep(2) await done.delete()
async def _(event): if event.fwd_from: return await event.edit("Starting a Mass-FedBan...") fedList = [] if event.reply_to_msg_id: previous_message = await event.get_reply_message() if previous_message.media: downloaded_file_name = await bot.download_media( previous_message, "fedlist") await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #TBMassBanned " else: FBAN = previous_message.sender_id REASON = event.text.split(" ", maxsplit=1)[1] if REASON.strip() == "": REASON = " #TBMassBanned " else: arg = event.text.split(" ", maxsplit=2) if len(arg) > 2: FBAN = arg[1] REASON = arg[2] else: FBAN = arg[1] REASON = " #TBMassBanned " try: int(FBAN) if int(FBAN) == 630654925 or int(FBAN) == 719195224: await event.edit("Something went wrong.") return except BaseException: if FBAN == "@HeisenbergTheDanger" or FBAN == "@xditya": await event.edit("Something went wrong.") return if Config.FBAN_GROUP_ID: chat = Config.FBAN_GROUP_ID else: chat = await event.get_chat() if not len(fedList): for a in range(3): async with bot.conversation("@MissRose_bot") as bot_conv: await bot_conv.send_message("/start") await bot_conv.send_message("/myfeds") await asyncio.sleep(3) response = await bot_conv.get_response() await asyncio.sleep(3) if "make a file" in response.text: await asyncio.sleep(6) await response.click(0) await asyncio.sleep(6) fedfile = await bot_conv.get_response() await asyncio.sleep(3) if fedfile.media: downloaded_file_name = await bot.download_media( fedfile, "fedlist") await asyncio.sleep(6) file = open(downloaded_file_name, "r") lines = file.readlines() for line in lines: try: fedList.append(line[:36]) except BaseException: pass else: return if len(fedList) == 0: await event.edit( f"Something went wrong. Retrying ({a+1}/3)...") else: break else: await event.edit(f"Error") if "You can only use fed commands once every 5 minutes" in response.text: await event.edit("Try again after 5 mins.") return In = False tempFedId = "" for x in response.text: if x == "`": if In: In = False fedList.append(tempFedId) tempFedId = "" else: In = True elif In: tempFedId += x if len(fedList) == 0: await event.edit("Something went wrong.") return await event.edit(f"Fbaning in {len(fedList)} feds.") try: await bot.send_message(chat, f"/start") except BaseException: await event.edit("FBAN_GROUP_ID is incorrect.") return await asyncio.sleep(3) if Config.EXCLUDE_FED: excludeFed = Config.EXCLUDE_FED.split("|") for n in range(len(excludeFed)): excludeFed[n] = excludeFed[n].strip() exCount = 0 for fed in fedList: if Config.EXCLUDE_FED and fed in excludeFed: await bot.send_message(chat, f"{fed} Excluded.") exCount += 1 continue await bot.send_message(chat, f"/joinfed {fed}") await asyncio.sleep(3) await bot.send_message(chat, f"/fban {FBAN} {REASON}") await asyncio.sleep(3) await event.edit( f"SuperFBan Completed. Affected {len(fedList) - exCount} feds.\n#TB")
async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit( f"`{DEFAULTUSER}:`**Rispondi ad un img/sticker/gif `.mms` e il testo, `.mms` testo ; e testo per metterlo pure sotto**" ) return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit(f"`{DEFAULTUSER}:`**Rispondi ad un img/sticker/gif**") return chat = "@MemeAutobot" sender = reply_message.sender file_ext_ns_ion = "@memetime.png" uploaded_gif = None if reply_message.sender.bot: await event.edit(f"`{DEFAULTUSER}:`**Rispondi a un user, no al bot.**") return else: await event.edit(f"`{DEFAULTUSER}:`**Inizio la modifica dell'img**") file = await bot.download_file(reply_message.media) async with bot.conversation("@MemeAutobot") as bot_conv: try: memeVar = event.pattern_match.group(1) await silently_send_message(bot_conv, "/start") await asyncio.sleep(1) await silently_send_message(bot_conv, memeVar) await bot.send_file(chat, reply_message.media) response = await bot_conv.get_response() except YouBlockedUserError: await event.reply("**Please sblocca `@MemeAutobot` **") return if response.text.startswith("Forward"): await event.edit(f"`{DEFAULTUSER}:`**privacy error**") if "Okay..." in response.text: await event.edit("**Inizio la modifica dell'img**") thumb = None if os.path.exists(thumb_image_path): thumb = thumb_image_path input_str = event.pattern_match.group(1) if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) if event.reply_to_msg_id: file_name = "meme.png" reply_message = await event.get_reply_message() to_download_directory = Config.TMP_DOWNLOAD_DIRECTORY downloaded_file_name = os.path.join(to_download_directory, file_name) downloaded_file_name = await bot.download_media( reply_message, downloaded_file_name, ) if os.path.exists(downloaded_file_name): await bot.send_file( chat, downloaded_file_name, force_document=False, supports_streaming=False, allow_cache=False, thumb=thumb, ) os.remove(downloaded_file_name) else: await event.edit("File Not Found {}".format(input_str)) response = await bot_conv.get_response() the_download_directory = Config.TMP_DOWNLOAD_DIRECTORY files_name = "memes.webp" download_file_name = os.path.join(the_download_directory, files_name) await bot.download_media( response.media, download_file_name, ) requires_file_name = Config.TMP_DOWNLOAD_DIRECTORY + "memes.webp" await borg.send_file( # pylint:disable=E0602 event.chat_id, requires_file_name, supports_streaming=False, caption="Userbot", ) await event.delete() sax = await bot.send_message(event.chat_id, "**☠️☠️10 Punti a Griffindor!🔥🔥**") await asyncio.sleep(4) sax.delete() elif not is_message_image(reply_message): await event.edit( "Invalid message type. Plz choose right message type.") return else: await bot.send_file(event.chat_id, response.media)
async def kang(args): if not args.text[0].isalpha() and args.text[0] not in ("/", "#", "@", "!"): user = await bot.get_me() userid = user.id username = user.username if not username: username = user.first_name message = await args.get_reply_message() photo = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) emojibypass = False elif "image" in message.media.document.mime_type.split('/'): photo = io.BytesIO() await bot.download_file(message.media.document, photo) if DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes: emoji = message.media.document.attributes[1].alt emojibypass = True else: await args.edit("`Unsupported File!`") return else: await args.edit("`Reply to photo to kang it bruh`") return if photo: image = Image.open(photo) maxsize = (512, 512) if (image.width and image.height) < 512: size1 = image.width size2 = image.height if image.width > image.height: scale = 512/size1 size1new = 512 size2new = size2 * scale else: scale = 512/size2 size1new = size1 * scale size2new = 512 size1new = math.floor(size1new) size2new = math.floor(size2new) sizenew = (size1new, size2new) image = image.resize(sizenew) else: image.thumbnail(maxsize) splat = args.text.split() if not emojibypass: emoji = "🤔" pack = "1" if len(splat) == 3: pack = splat[2] #User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): #User wants to push into different pack, but is okay with thonk as emote. pack = int(splat[1]) else: #User sent just custom emote, wants to push to default pack emoji = splat[1] packname = f"a{userid}_by_{username}_{pack}" response = urllib.request.urlopen(urllib.request.Request(f'http://t.me/addstickers/{packname}')) htmlstr = response.read().decode("utf8").split('\n') file = io.BytesIO() file.name = "sticker.png" image.save(file, "PNG") if " A <strong>Telegram</strong> user has created the <strong>Sticker Set</strong>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) await conv.get_response() file.seek(0) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("userbot sticker pack doesn't exist! Making a new one!") async with bot.conversation('Stickers') as conv: await conv.send_message('/newpack') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(f"@{username}'s userbot pack {pack}") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"sticker added! Your pack can be found [here](t.me/addstickers/{packname})", parse_mode='md')
async def seslimuzik(event): caption = "@BrendUserBot ilə səsli mesaja çevirildi." if event.fwd_from: return sarki = event.pattern_match.group(1) rep_msg = None if event.is_reply: rep_msg = await event.get_reply_message() if len(sarki) < 1: if event.is_reply: sarki = rep_msg.text else: await event.edit( "**Mənə bir səs adı ver və ya bir səsə cavab ver!** `İstifadəsi: .ses [hərhansı bir mahnı adı]`" ) return if event.is_reply: rep_msg = await event.get_reply_message() if rep_msg.audio: await event.edit(f"__Səs yüklənir...__") indir = await rep_msg.download_media() await event.edit( f"__Səsi yüklədim, səsli mesaj olaraq göndərirəm...__") voice = await asyncio.create_subprocess_shell( f"ffmpeg -i '{indir}' -y -c:a libopus 'unvoice.ogg'") await voice.communicate() if path.isfile("unvoice.ogg"): await event.client.send_file(event.chat_id, file="unvoice.ogg", voice_note=True, caption=caption, reply_to=rep_msg) await event.delete() remove("unvoice.ogg") else: await event.edit("`Səs, səsli mesaja çevrilə bilmədi!`") remove(indir) return if sarki.find("{n}") != -1: sarki = sarki.replace("{n}", "") sarki = sarki.strip() caption = "" await event.edit(f"__Yazdığınız musiqi axtarılır..: {sarki}__") chat = "@DeezerMusicBot" async with bot.conversation(chat) as conv: try: await conv.send_message(sarki) except YouBlockedUserError: await event.reply( f"` deyəsən` {chat} `bloklamısan. Zəhmət olmasa bloku açıb yenidən yoxla.`" ) return sesler = await conv.wait_event( events.NewMessage(incoming=True, from_users=595898211)) await event.client.send_read_acknowledge(conv.chat_id) if sesler.audio: try: titlemsg = sesler.audio.attributes[0].title + " adlı səs" except Exception: titlemsg = "Ses" await event.edit(f"__{titlemsg} tapıldı, yüklənir...") indir = await sesler.download_media() await event.edit( f"__{titlemsg} adlı səsi yüklədim, səsli mesaj olaraq göndərirəm..." ) voice = await asyncio.create_subprocess_shell( f"ffmpeg -i '{indir}' -y -c:a libopus 'unvoice.ogg'") await voice.communicate() if path.isfile("unvoice.ogg"): await event.client.send_file(event.chat_id, file="unvoice.ogg", voice_note=True, caption=caption, reply_to=rep_msg) await event.delete() remove("unvoice.ogg") else: await event.edit("`Tapılan səs səsli mesaja çevirə bilmədim!`") remove(indir) elif not sesler.buttons: await event.edit( f"`Botta uyğun şəkildə axtarmaq olmadı! Bota gedib botun cavabına baxa bilərsən. ({chat})`" ) elif sesler.buttons[0][0].text == "Nəticə Yoxdur": await event.edit( "`Axtardığınız mahnını tapa bilmədim! Bağışlayın.`") else: await sesler.click(0) ses = await conv.wait_event( events.NewMessage(incoming=True, from_users=595898211)) await event.client.send_read_acknowledge(conv.chat_id) try: titlemsg = ses.audio.attributes[0].title + " adlı ses" except Exception: titlemsg = "Ses" await event.edit(f"__{titlemsg} tapıldı, göndərilir...__") indir = await ses.download_media() await event.edit( f"__{titlemsg} `yüklədim.` **İnşAllah doğrudur :)**. `Səsli mesaj olaraq göndərirəm...`__" ) voice = await asyncio.create_subprocess_shell( f"ffmpeg -i '{indir}' -c:a libopus 'unvoice.ogg'") await voice.communicate() if path.isfile("unvoice.ogg"): await event.client.send_file(event.chat_id, file="unvoice.ogg", voice_note=True, caption=caption, reply_to=rep_msg) await event.delete() remove("unvoice.ogg") else: await event.edit( "`Ups mahnını və ya mp3ü’ü səsli mesaja çevirə bilmədim, bir xəta baş verdi!`" )
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split("/"): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.media.document.attributes): emoji = message.media.document.attributes[1].alt if emoji != "": emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, "AnimatedSticker.tgs") attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Arquivo não suportado!`") return else: await args.edit("`Não posso roubar isso...`") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username} kang library Book.{pack}" cmd = "/newpack" file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = "/newanimated" 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>." not in htmlstr): async with bot.conversation("Stickers") as conv: await conv.send_message("/addsticker") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username} kang library Book.{pack}" await args.edit("`Trocando para pacote " + str(pack) + " devido a espaço insuficiente`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Pack inválido selecionado.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"`Sticker adicionado a um pacote diferente !\ \nEsse pacote foi criado recentemente!\ \nSeu pacote pode ser achado [aqui](t.me/addstickers/{packname})", parse_mode="md", ) return if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Desculpe, o tipo de arquivo é inválido." in rsp.text: await args.edit( "`Falha ao adicionar adesivo, use` @Stickers `bot para adicionar o adesivo manualmente.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/done") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Preparando um novo pacote...`") async with bot.conversation("Stickers") as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Desculpe, o tipo de arquivo é inválido." in rsp.text: await args.edit( "`Falha ao adicionar adesivo, use` @Stickers `bot para adicionar o adesivo manualmente.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"`Sticker roubado com sucesso!`\ \nPacote pode ser achado [aqui](t.me/addstickers/{packname})", parse_mode="md", )
async def _(event): if event.fwd_from: return if not event.is_reply: await event.edit(f"`{DEFAULTUSER}:`**ℹ️ Rispondi ad un immagine per creare uno sticker.**") return reply_message = await event.get_reply_message() sticker_emoji = "🔥" input_str = event.pattern_match.group(1) if input_str: sticker_emoji = input_str user = await bot.get_me() if not user.first_name: user.first_name = user.id pack = 1 userid = event.from_id packname = f"{user.first_name} Pack Vol.{pack}" packshortname = f"vol_{pack}_with_{userid}" await event.edit("**👌🏻 Aggiungo sticker selezionato al Pack.**") is_a_s = is_it_animated_sticker(reply_message) file_ext_ns_ion = "Anubis69_roxx.png" file = await bot.download_file(reply_message.media) uploaded_sticker = None if is_a_s: file_ext_ns_ion = "AnimatedSticker.tgs" uploaded_sticker = await bot.upload_file(file, file_name=file_ext_ns_ion) packname = f"{user.first_name} Animated {pack}" if userid == 719877937: packshortname = "TheAnubis_Animated" else: packshortname = f"{user.first_name}_animated_{pack}" # format: Uni_Borg_userid elif not is_message_image(reply_message): await event.edit("Invalid message type") return else: with BytesIO(file) as mem_file, BytesIO() as sticker: resize_image(mem_file, sticker) sticker.seek(0) uploaded_sticker = await bot.upload_file(sticker, file_name=file_ext_ns_ion) async with bot.conversation("@Stickers") as bot_conv: now = datetime.datetime.now() dt = now + datetime.timedelta(minutes=1) if not await stickerset_exists(bot_conv, packshortname): await event.edit("**Creato un nuovo sticker pack!**") await silently_send_message(bot_conv, "/cancel") if is_a_s: response = await silently_send_message(bot_conv, "/newanimated") else: response = await silently_send_message(bot_conv, "/newpack") if "Yay!" not in response.text: await event.edit(f"**FAILED**! @Stickers : {response.text}") return response = await silently_send_message(bot_conv, packname) if not response.text.startswith("Alright!"): if "unacceptable" in response.text: packname = f"{user.id} Pack Vol.{pack}" response = await silently_send_message(bot_conv, packname) else: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") w = await bot_conv.send_file( file=uploaded_sticker, allow_cache=False, force_document=True ) response = await bot_conv.get_response() if "Sorry" in response.text: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return await silently_send_message(bot_conv, sticker_emoji) await silently_send_message(bot_conv, "/publish") response = await silently_send_message(bot_conv, f"<{packname}>") await silently_send_message(bot_conv, "/skip") response = await silently_send_message(bot_conv, packshortname) if response.text == "Sorry, il nome è gia in uso.": await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return elif response.text == "Sorry, il nome è inaccettabile.": packshortname = f"pack_{pack}_animated_{user.id}" await silently_send_message(bot_conv, packshortname) else: await silently_send_message(bot_conv, "/cancel") await silently_send_message(bot_conv, "/addsticker") await silently_send_message(bot_conv, packshortname) await bot_conv.send_file( file=uploaded_sticker, allow_cache=False, force_document=True ) response = await bot_conv.get_response() if response.text == "**🚫 Pack selezionato invalido.**": while response.text == "**🚫 Pack selezionato invalido.**": pack += 1 prevv = int(pack) - 1 packname = f"{user.first_name} Pack Vol.{pack}" packshortname = f"Pack._{pack}_di_{userid}" if not await stickerset_exists(bot_conv, packshortname): await event.edit("**Pack No. **" + str(prevv) + "** Pieno! Creato New Pack, Vol. **" + str(pack)) if is_a_s: response = await silently_send_message(bot_conv, "/newanimated") else: response = await silently_send_message(bot_conv, "/newpack") if "Yay!" not in response.text: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return response = await silently_send_message(bot_conv, packname) if not response.text.startswith("Alright!"): if "unacceptable" in response.text: packname = f"{user.id} Pack Vol.{pack}" response = await silently_send_message(bot_conv, packname) else: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") w = await bot_conv.send_file( file=uploaded_sticker, allow_cache=False, force_document=True ) response = await bot_conv.get_response() if "Sorry" in response.text: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return await silently_send_message(bot_conv, sticker_emoji) await silently_send_message(bot_conv, "/publish") response = await silently_send_message(bot_conv, f"<{packname}>") await silently_send_message(bot_conv, "/skip") response = await silently_send_message(bot_conv, packshortname) if response.text == "Il nome è gia in uso.": await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return elif response.text == "Il nome è inaccettabile.": packshortname = f"Pack_{pack}_animated_{user.id}" await silently_send_message(bot_conv, packshortname) else: await event.edit("Pack No. " + str(prevv) + " pieno! Passo a Vol. " + str(pack)) await silently_send_message(bot_conv, "/addsticker") await silently_send_message(bot_conv, packshortname) await bot_conv.send_file( file=uploaded_sticker, allow_cache=False, force_document=True ) response = await bot_conv.get_response() if "Sorry" in response.text: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return await silently_send_message(bot_conv, sticker_emoji) await silently_send_message(bot_conv, "/done") else: if "Sorry" in response.text: await event.edit(f"**🚫 ERRORE**! @Stickers : {response.text}") return await silently_send_message(bot_conv, response) await silently_send_message(bot_conv, sticker_emoji) await silently_send_message(bot_conv, "/done") await event.edit(f"**✅ Sticker aggiunto |** Lo puoi trovare** [qui](t.me/addstickers/{packshortname}), pack{pack}" f"di {DEFAULTUSER}\n ")
async def fedban_all(msg): if not msg.text[0].isalpha() and msg.text[0] not in ("/", "#", "@", "!"): try: from userbot.modules.sql_helper.fban_sql_helper import get_fban except AttributeError: await msg.edit("`Running on Non-SQL mode!`") return textx = await msg.get_reply_message() if textx: try: banreason = "[userbot] " banreason += banreason.join(msg.text.split(" ")[1:]) if banreason == "[userbot]": raise TypeError except TypeError: banreason = "[userbot] fban" else: banid = msg.text.split(" ")[1] if banid.isnumeric(): # if its a user id banid = int(banid) else: # deal wid the usernames if msg.message.entities is not None: probable_user_mention_entity = msg.message.entities[0] if isinstance(probable_user_mention_entity, MessageEntityMentionName): ban_id = probable_user_mention_entity.user_id try: banreason = "[userbot] " banreason += banreason.join(msg.text.split(" ")[2:]) if banreason == "[userbot]": raise TypeError except TypeError: banreason = "[userbot] fban" if "spam" in banreason: spamwatch = True else: spamwatch = False failed = dict() count = 1 fbanlist = [] x = (await get_fban()) for i in x: fbanlist.append(i["chatid"]) for bangroup in fbanlist: # Send to proof to Spamwatch in case it was spam # Spamwatch is a reputed fed fighting against spam on telegram if bangroup == -1001312712379: if spamwatch: if textx: await textx.forward_to(-1001312712379) # Tag him, coz we can't fban xd await bot.send_message(-1001312712379, "@SitiSchu") else: await msg.reply( "`Spam message detected. But no reply message, can't forward to spamwatch`" ) continue async with bot.conversation(bangroup) as conv: await conv.send_message(f"!fban {banid} {banreason}") resp = await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) if "Beginning federation ban " not in resp.text: failed[bangroup] = str(conv.chat_id) else: count += 1 await msg.edit("`Fbanned on " + str(count) + " feds!`") # Sleep to avoid a floodwait. # Prevents floodwait if user is a fedadmin on too many feds await asyncio.sleep(0.2) if failed: failedstr = "" for i in failed.keys(): failedstr += failed[i] failedstr += " " await msg.reply(f"`Failed to fban in {failedstr}`") else: await msg.reply("`Fbanned in all feds!`")
async def lastname(steal): if steal.fwd_from: return if not steal.reply_to_msg_id: await steal.edit( "```Mohon Reply Ke Pesan Pengguna Yang Ingin Anda Scan Yang Mulia.```" ) return message = await steal.get_reply_message() chat = "@SangMataInfo_bot" user_id = message.sender.id id = f"/search_id {user_id}" if message.sender.bot: await steal.edit("```Reply Ke Pesan Pengguna Yang Ingin Di Scann.```") return await steal.edit("__C__") await steal.edit("__Co__") await steal.edit("__Con__") await steal.edit("__Conn__") await steal.edit("__Conne__") await steal.edit("__Connec__") await steal.edit("__Connect__") await steal.edit("__Connecti__") await steal.edit("__Connectin__") await steal.edit("__Connecting__") await steal.edit("__Connecting t__") await steal.edit("__Connecting to__") await steal.edit("__Connecting to s__") await steal.edit("__Connecting to se__") await steal.edit("__Connecting to ser__") await steal.edit("__Connecting to serv__") await steal.edit("__Connecting to serve__") await steal.edit("__Connecting to server__") await steal.edit("__Connecting to server.__") await steal.edit("__Connecting to server..__") await steal.edit("__Connecting to server...__") try: async with bot.conversation(chat) as conv: try: msg = await conv.send_message(id) r = await conv.get_response() response = await conv.get_response() except YouBlockedUserError: await steal.reply( "```Yang Mulia, Mohon Unblock @sangmatainfo_bot Dan Coba Scan Kembali.```" ) return if r.text.startswith("Name"): respond = await conv.get_response() await steal.edit(f"`{r.message}`") await steal.client.delete_messages( conv.chat_id, [msg.id, r.id, response.id, respond.id]) return if response.text.startswith("No records") or r.text.startswith( "No records"): await steal.edit( "```Saya Tidak Menemukan Informasi Pergantian Nama Ini Yang Mulia, Orang Ini Belum Pernah Mengganti Nama Sebelumnya```" ) await steal.client.delete_messages(conv.chat_id, [msg.id, r.id, response.id]) return else: respond = await conv.get_response() await steal.edit(f"```{response.message}```") await steal.client.delete_messages( conv.chat_id, [msg.id, r.id, response.id, respond.id]) except TimeoutError: return await steal.edit("`Saya Sedang Sakit Yang Mulia, Mohon Maaf`")
async def dizla(args): """ .dızla komutu çıkartmaları başka paketten alır ya da yeni bir çıkartma oluşturur. """ user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{PLUGIN_MESAJLAR['dızcı']}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{PLUGIN_MESAJLAR['dızcı']}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{PLUGIN_MESAJLAR['dızcı']}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Desteklenmeyen dosya!`") return else: await args.edit("`Bunu dızlayamam...`") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # Kullanıcı ikisini de gönderebilir emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # Kullanıcı başka pakete eklemek istiyor. pack = int(splat[1]) else: # Kullanıcı sadece özel emoji istedi, varsayılan pakete eklemek istiyor. emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s @AsenaUserBot pack {pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animasyonlu)" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s @AsenaUserBot pack {pack}" await args.edit("`Yetersiz paket alanından dolayı " + str(pack) + " numaralı pakete geçiliyor`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Geçersiz paket seçildi.": await conv.send_message(cmd) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Kullanıcının sürekli bildirim almamasını sağlar. await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Çıkartma başka bir pakete eklendi.\ \nBu paket yeni oluşturuldu.\ \nYeni paket [burada](t.me/addstickers/{packname}) bulunabilir.", parse_mode='md') return if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Çıkartma ekleme başarısız, ` @Stickers `botu ile elle eklemeyi deneyin.`" ) return await conv.send_message(emoji) # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Yeni paket oluşturuluyor...`") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Çıkartma ekleme başarısız, ` @Stickers `botu ile elle eklemeyi deneyin.`" ) return await conv.send_message(emoji) # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Kullanıcının sürekli bildirim almamasını sağlar. await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Kullanıcının sürekli bildirim almamasını sağlar. await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Çıkartma başarıyla pakete eklendi.`\ \nPaket [şurada](t.me/addstickers/{packname}) bulunabilir.", parse_mode='md')
async def kang(event): """ Function for .kang command, create a sticker pack and add stickers. """ await event.edit('`Kanging...`') 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() emoji = event.pattern_match.group(2) # If no number specified, use 1 number = int(event.pattern_match.group(3) or 1) new_pack = False if textx.photo or textx.sticker: message = textx elif event.photo or event.sticker: message = event else: await event.edit( "`You need to send/reply to a sticker/photo to be able to kang it!`" ) return sticker = io.BytesIO() await bot.download_media(message, sticker) sticker.seek(0) if not sticker: await event.edit( "`Couldn't download sticker! Make sure you send a proper sticker/photo.`" ) return is_anim = message.file.mime_type == "application/x-tgsticker" if not is_anim: img = await resize_photo(sticker) sticker.name = "sticker.png" sticker.seek(0) img.save(sticker, "PNG") # The user didn't specify an emoji... if not emoji: if message.file.emoji: # ...but the sticker has one emoji = message.file.emoji else: # ...and the sticker doesn't have one either emoji = "🤔" 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 # 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.`" ) if new_pack: await event.edit( "`This Paperplane Sticker Pack doesn't exist! Creating a new pack...`" ) await newpack(is_anim, sticker, emoji, packtitle, packname) else: async with bot.conversation('t.me/Stickers') as conv: # Cancel any pending command await conv.send_message('/cancel') await conv.get_response() # Send the add sticker command await conv.send_message('/addsticker') await conv.get_response() # Send the pack name await conv.send_message(packname) x = await conv.get_response() # Check if the selected pack is full while x.text == PACK_FULL: # Switch to a new pack, create one if it doesn't exist number += 1 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 ''}") await event.edit( f"`Switching to Pack {number} due to insufficient space in Pack {number-1}.`" ) await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": # That pack doesn't exist await newpack(is_anim, sticker, emoji, packtitle, packname) # 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 added to pack {number}{'(animated)' if is_anim else ''} with " f"{emoji} as the emoji! " f"This pack can be found `[here](t.me/addstickers/{packname})", parse_mode='md') return # Upload the sticker file if is_anim: upload = await message.client.upload_file( sticker, file_name="AnimatedSticker.tgs") await conv.send_file(upload, force_document=True) else: sticker.seek(0) await conv.send_file(sticker, force_document=True) await conv.get_response() # Send the emoji await conv.send_message(emoji) await conv.get_response() # Finish editing the pack await conv.send_message('/done') 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 added to pack {number}{'(animated)' if is_anim else ''} with " f"{emoji} as the emoji! " f"This pack can be found `[here](t.me/addstickers/{packname})", parse_mode='md')
async def newpack(is_anim, sticker, emoji, packtitle, packname, message): 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() # Upload sticker file if is_anim: upload = await bot.upload_file(sticker, file_name="AnimatedSticker.tgs") await conv.send_file(upload, force_document=True) else: sticker.seek(0) await conv.send_file(sticker, force_document=True) kontrol = await conv.get_response() if kontrol.message.startswith("Sorry"): await bot.send_file("@ezstickerbot", message, force_document=True) try: response = await conv.wait_event( events.NewMessage(incoming=True, from_users=350549033)) if "Please temporarily use" in response.text: await bot.send_file("@EzStickerBotBackupBot", message, force_document=True) response = await conv.wait_event( events.NewMessage(incoming=True, from_users=891811251)) await bot.send_read_acknowledge(350549033) await bot.forward_messages("stickers", response.message, 350549033) except: await bot.send_file("@EzStickerBotBackupBot", message, force_document=True) response = await conv.wait_event( events.NewMessage(incoming=True, from_users=891811251)) await bot.send_read_acknowledge(891811251) await bot.forward_messages("stickers", response.message, 891811251) # Send the emoji await conv.send_message(emoji) await conv.get_response() # 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()
return await event.edit( "**Error: This action has been prevented by KensurBot self preservation protocols.**" ) if len((fed_list := get_flist())) == 0: return await event.edit("**You haven't connected to any federations yet!**") await event.edit(f"**Fbanning** {user_link}...") failed = [] total = int(0) for i in fed_list: total += 1 chat = int(i.chat_id) try: async with bot.conversation(chat) as conv: await conv.send_message(f"/fban {user_link} {reason}") reply = await conv.get_response() await bot.send_read_acknowledge( conv.chat_id, message=reply, clear_mentions=True ) if ( ("New FedBan" not in reply.text) and ("Starting a federation ban" not in reply.text) and ("Start a federation ban" not in reply.text) and ("FedBan reason updated" not in reply.text) ): failed.append(i.fed_name) except BaseException: failed.append(i.fed_name)
async def kang(event): await event.edit(f"`{PLUGIN_MESAJLAR['dızcı']}`") 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() emoji = event.pattern_match.group(2) number = int(event.pattern_match.group(3) or 1) # If no number specified, use 1 new_pack = False if textx.photo or textx.sticker: message = textx elif event.photo or event.sticker: message = event else: await event.edit( "`Dızlayabilmem için bana sticker veya fotoğraf vermen gerek!`") return sticker = io.BytesIO() await bot.download_media(message, sticker) sticker.seek(0) if not sticker: await event.edit( "`Sticker indirilemedi! Fotoğraf veya sticker gönderdiğinize emin olun.`" ) return is_anim = message.file.mime_type == "application/x-tgsticker" if not is_anim: img = await resize_photo(sticker) sticker.name = "sticker.png" sticker.seek(0) img.save(sticker, "PNG") # The user didn't specify an emoji... if not emoji: if message.file.emoji: # ...but the sticker has one emoji = message.file.emoji else: # ...and the sticker doesn't have one either emoji = "🤔" packname = f"a{user.id}_by_{pack_username}_{number}{'_anim' if is_anim else ''}" packtitle = (f"@{user.username or user.first_name} {PAKET_ISMI} " f"{number}{' animasyonlu' 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 new_pack: await event.edit( "`Sticker paketi oluşturulmamış! Yeni paket oluşturuluyor...`") await newpack(is_anim, sticker, emoji, packtitle, packname, message) else: async with bot.conversation("Stickers") as conv: # Cancel any pending command await conv.send_message('/cancel') await conv.get_response() # Send the add sticker command await conv.send_message('/addsticker') await conv.get_response() # Send the pack name await conv.send_message(packname) x = await conv.get_response() # Check if the selected pack is full while x.text == PACK_FULL: # Switch to a new pack, create one if it doesn't exist number += 1 packname = f"a{user.id}_by_{pack_username}_{number}{'_anim' if is_anim else ''}" packtitle = ( f"@{user.username or user.first_name} {PAKET_ISMI} " f"{number}{' animated' if is_anim else ''}") await event.edit( f"`Yetersiz paket alanından dolayı {number} sayılı pakete geçiliyor...`" ) await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": # That pack doesn't exist await newpack(is_anim, sticker, emoji, packtitle, packname) # Read all unread messages await bot.send_read_acknowledge("stickers") # Unmute Stickers bot back muted = await bot( UpdateNotifySettingsRequest( peer=429000, settings=InputPeerNotifySettings(mute_until=None))) await event.edit( f"`Sticker {number}{'(animasyonlu)' if is_anim else ''} sayılı pakete eklendi, " f"{emoji} emojisi ile birlikte! " f"Paket `[burada](t.me/addstickers/{packname})`bulunabilinir.`", parse_mode='md') return # Upload the sticker file if is_anim: upload = await message.client.upload_file( sticker, file_name="AnimatedSticker.tgs") await conv.send_file(upload, force_document=True) else: sticker.seek(0) await conv.send_file(sticker, force_document=True) kontrol = await conv.get_response() if "Sorry, the image dimensions are invalid." in kontrol.text: await event.edit( "`Sticker's kabul etmedi. İkinci yöntem deneniyor...`") try: await bot.send_file("@ezstickerbot", message, force_document=True) except YouBlockedUserError: return await event.edit( "`Lütfen` @EzStickerBot `engelini açın ve tekrar deneyin!`" ) try: response = await conv.wait_event( events.NewMessage(incoming=True, from_users=350549033)) if "Please temporarily use" in response.text: await bot.send_file("@EzStickerBotBackupBot", message, force_document=True) response = await conv.wait_event( events.NewMessage(incoming=True, from_users=891811251)) await bot.send_read_acknowledge(350549033) await event.client.forward_messages( "stickers", response.message, 350549033) except: await bot.send_file("@EzStickerBotBackupBot", message, force_document=True) response = await conv.wait_event( events.NewMessage(incoming=True, from_users=891811251)) await bot.send_read_acknowledge(891811251) await event.client.forward_messages( "stickers", response.message, 891811251) # Send the emoji await conv.send_message(emoji) await conv.get_response() # Finish editing the pack await conv.send_message('/done') await conv.get_response() # Read all unread messages await bot.send_read_acknowledge(429000) # Unmute Stickers bot back muted = await bot( UpdateNotifySettingsRequest( peer=429000, settings=InputPeerNotifySettings(mute_until=None))) await event.edit( f"`Sticker {number}{'(animasyonlu)' if is_anim else ''} sayılı pakete eklendi, " f"{emoji} emojisi ile birlikte! " f"Paket `[burada](t.me/addstickers/{packname})` bulunabilinir.`", parse_mode='md')
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ user = await bot.get_me() if not user.username: try: user.first_name.encode('utf-8').decode('ascii') user.username = user.first_name except UnicodeDecodeError: user.username = f"cat_{user.id}" message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Unsupported File!`") return else: await args.edit("`I can't kang that...`") return if photo: splat = args.text.split() if emojibypass: emoji = emoji else: emoji = "😂" pack = 1 if len(splat) == 3: if char_is_emoji(splat[1]): if char_is_emoji(splat[2]): return await args.edit("check `.info stickers`") pack = splat[2] # User sent both emoji = splat[1] elif char_is_emoji(splat[2]): pack = splat[1] # User sent both emoji = splat[2] else: return await args.edit("check `.info stickers`") elif len(splat) == 2: if char_is_emoji(splat[1]): emoji = splat[1] else: pack = splat[1] packname = f"{user.username}_{pack}" packnick = f"@{user.username}'s_{pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "Whoa! That's probably enough stickers for one pack, give it a break" in x.text: try: val = int(pack) pack = val + 1 except ValueError: pack = 1 if not is_anim: packname = f"{user.username}_{pack}" packnick = f"@{user.username}'s_{pack}" else: packname = f"{user.username}_{pack}_anim" packnick = f"@{user.username}'s_{pack} (Animated)" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "You can list several emoji in one message, but I recommend using no more than two per sticker" not in rsp.text: await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Failed to add sticker, use @Stickers bot to add the sticker manually.\n**error :**{rsp.txt}" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"Sticker added in a Different Pack !\ \nThis Pack is Newly created!\ \nYour pack can be found [here](t.me/addstickers/{packname}) and emoji of the sticker added is {emoji}", parse_mode='md') return if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "You can list several emoji in one message, but I recommend using no more than two per sticker" not in rsp.text: await bot.send_read_acknowledge(conv.chat_id) await args.edit( f"Failed to add sticker, use @Stickers bot to add the sticker manually.\n**error :**{rsp.text}" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Brewing a new Pack...`") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "You can list several emoji in one message, but I recommend using no more than two per sticker" not in rsp.text: await args.edit( f"Failed to add sticker, use @Stickers bot to add the sticker manually.\n**error :**{rsp}" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"Sticker kanged successfully!\ \nPack can be found [here](t.me/addstickers/{packname}) and emoji of the sticker is {emoji}", parse_mode='md')
async def kang(args): user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split("/"): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name="sticker.webp") in message.media.document.attributes): emoji = message.media.document.attributes[1].alt if emoji != "": emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, "AnimatedSticker.tgs") attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: return await args.edit("`Unsupported File!`") else: return await args.edit("`Itu ga bisa dicolong...`") if photo: splat = args.text.split() if not emojibypass: emoji = "⚫" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s kang pack Vol.{pack}" cmd = "/newpack" file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = "/newanimated" 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>." not in htmlstr): async with bot.conversation("Stickers") as conv: await conv.send_message("/addsticker") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while "120" in x.text: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s kang pack Vol.{pack}" await args.edit("`Switching to Pack " + str(pack) + " due to insufficient space`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) return await args.edit( "`Sticker ditambahkan ke pack ynag berbeda !" "\nIni pack yang baru saja kamu buat!" f"\nKlik [disini](t.me/addstickers/{packname}) untuk liat pack kamj", parse_mode="md", ) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: return await args.edit( "`gagal menambahkan sticker, gunakan` @Stickers `bot untuk menambahkan sticker.`" ) await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/done") await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Buat Pack sticker baru`") async with bot.conversation("Stickers") as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file("AnimatedSticker.tgs") remove("AnimatedSticker.tgs") else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: return await args.edit( "`gagal menambahkan sticker, gunakan` @Stickers `bot untuk menambahkan sticker.`" ) await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit( "`Sticker Sukses Tercolong!`" f"\nKlik [disini](t.me/addstickers/{packname}) kalo mau pake pack stikerku", parse_mode="md", )
async def kang(args): """ For .kang command, kangs stickers or creates new ones. """ kang_meme = random.choice(KANGING_STR) user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{kang_meme}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{kang_meme}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{kang_meme}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: await args.edit("`Unsupported File! lol dont f**k me again`") return else: await args.edit("`I can't Kang that...`") return if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = 1 if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: if splat[1].isnumeric(): # User wants to push into different pack, but is okay with # thonk as emote. pack = int(splat[1]) else: # User sent just custom emote, wants to push to default # pack emoji = splat[1] packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s kang pack Vol.{pack}" cmd = '/newpack' file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") else: packname += "_anim" packnick += " (Animated)" cmd = '/newanimated' 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>." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) x = await conv.get_response() while x.text == PACK_FULL: pack += 1 packname = f"a{user.id}_by_{user.username}_{pack}" packnick = f"@{user.username}'s Kang pack Vol.{pack}" await args.edit(f"`{kang_meme}\ \n\nNOTE: Sticker will be added to Vol.{str(pack)}`") await conv.send_message(packname) x = await conv.get_response() if x.text == "Invalid pack selected.": await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) await conv.get_response() await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Haha, yes. New kang pack unlocked!\ \nPack can be found [here](t.me/addstickers/{packname})", parse_mode='md') return if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await args.edit("`Brewing a new Pack...`") async with bot.conversation('Stickers') as conv: await conv.send_message(cmd) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packnick) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) return await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message("/publish") if is_anim: await conv.get_response() await conv.send_message(f"<{packnick}>") # Ensure user doesn't get spamming notifications await conv.get_response() await bot.send_read_acknowledge(conv.chat_id) await conv.send_message("/skip") # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message(packname) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await args.edit(f"`Sticker Tercolong successfully!`\ \nPack can be found [here](t.me/addstickers/{packname})", parse_mode='md')
async def kas(args): """ For .kas command, kangs stickers to existed pack. """ user = await bot.get_me() if not user.username: user.username = user.first_name message = await args.get_reply_message() photo = None emojibypass = False is_anim = False emoji = None if message and message.media: if isinstance(message.media, MessageMediaPhoto): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() photo = await bot.download_media(message.photo, photo) elif "image" in message.media.document.mime_type.split('/'): await args.edit(f"`{random.choice(KANGING_STR)}`") photo = io.BytesIO() await bot.download_file(message.media.document, photo) if (DocumentAttributeFilename(file_name='sticker.webp') in message.media.document.attributes): emoji = message.media.document.attributes[1].alt if emoji != '': emojibypass = True elif "tgsticker" in message.media.document.mime_type: await args.edit(f"`{random.choice(KANGING_STR)}`") await bot.download_file(message.media.document, 'AnimatedSticker.tgs') attributes = message.media.document.attributes for attribute in attributes: if isinstance(attribute, DocumentAttributeSticker): emoji = attribute.alt emojibypass = True is_anim = True photo = 1 else: return await args.edit("`Unsupported File!`") else: return await args.edit("`I can't kang that...`") if photo: splat = args.text.split() if not emojibypass: emoji = "🤔" pack = "No" if len(splat) == 3: pack = splat[2] # User sent both emoji = splat[1] elif len(splat) == 2: pack = splat[1] else: return args.edit( "I can't do that. " "Use `.kangas <emoji> <pack name>`, or " "`.kangas <pack name>`", parse_mode='md') packname = f"{pack}" file = io.BytesIO() if not is_anim: image = await resize_photo(photo) file.name = "sticker.png" image.save(file, "PNG") bot.conversation('Stickers').send_message('/cancel') response = urllib.request.urlopen( urllib.request.Request(f'http://t.me/addstickers/{packname}')) htmlstr = response.read().decode("utf8").split('\n') if "Invalid pack selected." not in htmlstr: async with bot.conversation('Stickers') as conv: await conv.send_message('/addsticker') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.send_message(packname) await conv.get_response() if is_anim: await conv.send_file('AnimatedSticker.tgs') remove('AnimatedSticker.tgs') else: file.seek(0) await conv.send_file(file, force_document=True) rsp = await conv.get_response() if "Sorry, the file type is invalid." in rsp.text: return await args.edit( "`Failed to add sticker, use` @Stickers `bot to add the sticker manually.`" ) await conv.send_message(emoji) # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) await conv.get_response() await conv.send_message('/done') await conv.get_response() # Ensure user doesn't get spamming notifications await bot.send_read_acknowledge(conv.chat_id) else: await conv.send_message('/cancel') await bot.send_read_acknowledge(conv.chat_id) return await args.edit(f"\nYou don't have {packname}. Canceled.)", parse_mode='md') await args.edit( "`Sticker kanged successfully!`" f"\nPack can be found [here](t.me/addstickers/{packname})", parse_mode='md')