Example #1
0
    def textpassjob(self, update: Update) -> bool:
        t = update.message.text.split()
        if getmsgfromid(update) != ADMIN_ID or (t[0] != "jobcomfirm"
                                                and t[0] != "jobreject"):
            self.botchat(update)
            return

        if len(t) < 2 or not isint(t[1]):
            return self.errorInfo("参数无效")

        plid = int(t[1])
        if plid not in self.addjobrequest:
            return self.errorInfo("没有该id的职业新增申请")

        self.popOP(ADMIN_ID)
        if t[0] == "jobcomfirm":
            self.joblist[self.addjobrequest[plid]
                         [0]] = self.addjobrequest[plid][1]

            with open(PATH_JOBDICT, 'w', encoding='utf-8') as f:
                json.dump(self.joblist, f, indent=4, ensure_ascii=False)

            self.reply(plid, "您的新增职业申请已通过。")

        else:
            self.reply(plid, "您的新增职业申请没有通过。")

        return True
Example #2
0
    def textsetsex(self, update: Update, plid: int) -> bool:
        if plid == 0:  # 私聊情形
            plid = getchatid(update)

        if getmsgfromid(update) != plid:
            return True

        self.popOP(getchatid(update))
        text = update.message.text

        cardi = self.findcard(plid)
        if not cardi:
            return self.errorInfo("找不到卡。")
        return self.cardsetsex(update, cardi, text)
Example #3
0
    def textdelcard(self, update: Update, cardid: int) -> bool:
        cardi = self.findcardwithid(cardid)
        if not cardi:
            self.popOP(update.effective_chat.id)
            return self.errorInfo("找不到卡。")

        kpid = getmsgfromid(update)
        if cardi.group.kp is None or kpid != cardi.group.kp.id:
            return True

        self.popOP(update.effective_chat.id)
        if update.message.text != "确认":
            self.reply("已经取消删除卡片操作。")
        else:
            self.reply("卡片已删除。")
            self.popcard(cardid)
        return True
Example #4
0
    def textsetname(self, update: Update, plid: int) -> bool:
        if plid == 0:  # 私聊情形
            plid = getchatid(update)

        if getmsgfromid(update) != plid:
            return True  # 不处理

        self.popOP(getchatid(update))

        text = ' '.join(update.message.text.split())

        cardi = self.findcard(plid)
        if not cardi:
            return self.errorInfo("找不到卡。")

        self.nameset(cardi, text)
        self.reply("姓名设置完成:" + text)
        return True