def process_removegirl(self, update, command, params): params = params.replace(" ", "").lower() chat_id = update.message.chat_id self.bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.TYPING) girls = list(Girl.select(Girl.username == params)) if girls: girls[0].delete_instance() self.bot.sendMessage(chat_id=chat_id, text="Removed girl '%s'" % params)
def process_girl(self, update, command, params): girls = list(Girl.select()) chat_id = update.message.chat_id if girls: self.bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO) girl = random.choice(girls) media = self.instagram.load_user_feed(girl.user_id, count=50) media = random.choice(media) image_url = media.images["standard_resolution"].url self.bot.sendPhoto(chat_id=chat_id, photo=image_url, caption=self.instagram.get_user_page(girl.username)) else: self.bot.sendChatAction(chat_id=chat_id, action=telegram.ChatAction.TYPING) self.bot.sendMessage(chat_id=chat_id, text="No girls(")