commands.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:SoftcatalaTelegramBot 作者: Softcatala 项目源码 文件源码
def cancel_command(self, bot, update):
        user_id = update.message.from_user.id
        draft = self.store.get_draft(user_id)

        if draft:
            self.store.remove_draft(update.message.from_user.id)
            bot.sendMessage(
            update.message.chat_id,
            text="\U0001F5D1 S'ha cancel·lat la creació de la publicació.",
            reply_markup=ReplyKeyboardHide()
            )
        else:
            if str(user_id) in allowed_users.values():
                bot.sendMessage(
                update.message.chat_id,
                text="\u26A0\uFE0F No hi ha res a cancel·lar.\nAquesta comanda només funciona quan s'ha iniciat la creació d'una publicació.",
                reply_markup=ReplyKeyboardHide()
            )
            elif function['production']:
                f_name = update.message.from_user.first_name
                bot.sendMessage(
                update.message.chat_id,
                text= str(f_name) + ", no teniu permisos per utilitzar aquesta ordre. Les ordres que teniu disponibles ara mateix són: /baixa /android /ios /tdesktop i /help.",
                reply_markup=ReplyKeyboardHide()
            )
            else:
                bot.sendMessage(
                update.message.chat_id,
                text="Robot destinat a proves internes de Softcatalà. Si cerqueu el bot públic de Softcatalà el trobareu a @SoftcatalaBot.",
                reply_markup=ReplyKeyboardHide()
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号