def main(): START_HANDLER = CommandHandler("start", start) HELP_HANDLER = CommandHandler("help", help) dispatcher.add_handler(START_HANDLER) dispatcher.add_handler(HELP_HANDLER) if WEBHOOK: logger.info("Using webhooks.") updater.start_webhook(listen=LISTEN, port=PORT, url_path=TOKEN) if CERT_PATH: updater.bot.set_webhook(url=URL + TOKEN, certificate=open(CERT_PATH, 'rb')) else: updater.bot.set_webhook(url=URL + TOKEN) else: logger.info("Using long polling.") updater.start_polling(timeout=15, read_latency=4) updater.idle()
msg.reply_text( "Your pack can be found [here](t.me/addstickers/%s)" % packname, parse_mode=ParseMode.MARKDOWN) elif e.message == "Peer_id_invalid": msg.reply_text("Contact me in PM first.", reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton(text="Start", url=f"t.me/{bot.username}") ]])) elif e.message == "Internal Server Error: created sticker set not found (500)": msg.reply_text( "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)" % packname, parse_mode=ParseMode.MARKDOWN) return if success: msg.reply_text( "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)" % packname, parse_mode=ParseMode.MARKDOWN) else: msg.reply_text( "Failed to create sticker pack. Possibly due to blek mejik.") __mod_name__ = "Stickers" KANG_HANDLER = CommandHandler("kang", kang, pass_args=True) dispatcher.add_handler(KANG_HANDLER)
msg = msg.replace(character, "") # idk PIL. this part was untouched and ask @devrism for better explanation. According to my understanding, Image.new creates a new image and paste "pastes" the character one by one comparing it with "value" variable x = 0 y = 896 image = Image.new('RGBA', [x, y], (0, 0, 0)) for character in msg: value = thonkifydict.get(character) addedimg = Image.new('RGBA', [x + value.size[0] + tracking.size[0], y], (0, 0, 0)) addedimg.paste(image, [0, 0]) addedimg.paste(tracking, [x, 0]) addedimg.paste(value, [x + tracking.size[0], 0]) image = addedimg x = x + value.size[0] + tracking.size[0] maxsize = 1024, 896 if image.size[0] > maxsize[0]: image.thumbnail(maxsize, Image.ANTIALIAS) # put processed image in a buffer and then upload cause async with BytesIO() as buffer: buffer.name = 'image.png' image.save(buffer, 'PNG') buffer.seek(0) bot.send_sticker(chat_id=message.chat_id, sticker=buffer) THONKIFY_HANDLER = CommandHandler("thonkify", thonkify) dispatcher.add_handler(THONKIFY_HANDLER)
os.remove("sticker.png") # shitty maymay modules made by @divadsn ^^^ COPYPASTA_HANDLER = CommandHandler("cp", copypasta) CLAPMOJI_HANDLER = CommandHandler("clap", clapmoji) BMOJI_HANDLER = CommandHandler("bify", bmoji) OWO_HANDLER = CommandHandler("owo", owo) STRETCH_HANDLER = CommandHandler("stretch", stretch) VAPOR_HANDLER = CommandHandler("vapor", vapor, pass_args=True) MOCK_HANDLER = CommandHandler("mock", spongemocktext) ZALGO_HANDLER = CommandHandler("zalgofy", zalgotext) FORBES_HANDLER = CommandHandler("forbes", forbesify) DEEPFRY_HANDLER = CommandHandler("deepfry", deepfryer) ME_TOO_THANKS_HANDLER = RegexHandler(r"(?i)me too", me_too) CHINESEMEMES_HANDLER = CommandHandler("dllm", chinesememes, pass_args=True) dispatcher.add_handler(COPYPASTA_HANDLER) dispatcher.add_handler(CLAPMOJI_HANDLER) dispatcher.add_handler(BMOJI_HANDLER) dispatcher.add_handler(OWO_HANDLER) dispatcher.add_handler(STRETCH_HANDLER) dispatcher.add_handler(VAPOR_HANDLER) dispatcher.add_handler(MOCK_HANDLER) dispatcher.add_handler(ZALGO_HANDLER) dispatcher.add_handler(FORBES_HANDLER) dispatcher.add_handler(DEEPFRY_HANDLER) dispatcher.add_handler(ME_TOO_THANKS_HANDLER) dispatcher.add_handler(CHINESEMEMES_HANDLER)