def glitch_image(bot: BOT, message: Message): if not message.reply_to_message: message.edit("`.glitch` needs to be a reply.") sleep(2) elif message.reply_to_message: try: glitch_amount = int(message.command[1]) except (IndexError, ValueError): glitch_amount = 1 glitch_this = message.reply_to_message.download() glitch_ext = glitch_this.split(".")[-1].lower() if glitch_ext in ('jpg', 'jpeg'): for _ in range(glitch_amount): glitched = glitchart.jpeg(photo=glitch_this, inplace=True) bot.send_photo(chat_id=message.chat.id, photo=glitched, caption=f"{glitch_amount} iterations" if glitch_amount > 1 else "", reply_to_message_id=ReplyCheck(message)) message.delete() rmtree('downloads')
def send_cat(bot: BOT, message: Message): doggo = requests.get('http://aws.random.cat/meow').json() BOT.send_photo(chat_id=message.chat.id, photo=doggo['file'], caption="catto", reply_to_message_id=ReplyCheck(message)) if message.from_user.is_self: message.delete()
def send_dog(bot: BOT, message: Message): doggo = requests.get('https://random.dog/woof.json?filter=webm,mp4').json() BOT.send_photo(chat_id=message.chat.id, photo=doggo['url'], caption="doggo", reply_to_message_id=ReplyCheck(message)) if message.from_user.is_self: message.delete()
def send_person(bot: BOT, message: Message): BOT.send_photo( chat_id=message.chat.id, photo="https://thispersondoesnotexist.com/image?randomtag=" + str(randint(0, 9999)), caption="persono", reply_to_message_id=ReplyCheck(message)) if message.from_user.is_self: message.delete()
def who_is(bot: BOT, message: Message): cmd = message.command if not message.reply_to_message and len(cmd) == 1: get_user = message.from_user.id elif message.reply_to_message and len(cmd) == 1: get_user = message.reply_to_message.from_user.id elif len(cmd) > 1: get_user = cmd[1] try: get_user = int(cmd[1]) except ValueError: pass try: user = BOT.get_users(get_user) except PeerIdInvalid: message.edit("I don't know that User.") sleep(2) message.delete() return desc = BOT.get_chat(get_user).description user_pic = BOT.get_user_profile_photos(user.id) common = GetCommon(user.id) if not user.photo: message.edit(WHOIS.format( full_name=FullName(user), user_id=user.id, first_name=user.first_name, last_name=user.last_name if user.last_name else "", username=user.username if user.username else "", last_online=LastOnline(user), common_groups=len(common.chats), bio=desc if desc else "`No bio set up.`"), disable_web_page_preview=True) elif user.photo: BOT.send_photo(message.chat.id, user_pic.photos[0].sizes[-1].file_id, WHOIS_PIC.format( full_name=FullName(user), user_id=user.id, first_name=user.first_name, last_name=user.last_name if user.last_name else "", username=user.username if user.username else "", last_online=LastOnline(user), profile_pics=user_pic.total_count, common_groups=len(common.chats), bio=desc if desc else "`No bio set up.`", profile_pic_update=ProfilePicUpdate(user_pic)), reply_to_message_id=ReplyCheck(message)) message.delete()