def handle_def(self, bot, update): text = update.message.text logger.debug("/def received: %s", text) channel_telegram_id = update.message.chat.id channel_telegram_name = update.message.chat.username user_telegram_id = update.message.from_user.id user_telegram_name = update.message.from_user.username or update.message.from_user.first_name or "Unknown" reply = update.message.reply_text parts = text.split(None, 2) if len(parts) == 3: term = parts[1].lower() term_content = parts[2] user = User.find_create(user_telegram_id, user_telegram_name) channel = Channel.find_create(channel_telegram_id, channel_telegram_name) Definition.insert_update(user, channel, term, term_content) logger.debug("Saved definition for %s", term) reply("Your definition for term '{}' has been saved".format(term)) else: reply( "Please provide a term and it's content to create or update.")