Exemple #1
0
    def run(self):
        update = self.update
        bot = self.bot
        
        if isDos(update): return
        if(not checkpermission(update)):   return

        update.message.reply_text(xhelp_en)
        
        appendlog(getID(update), update.message.from_user.full_name, update.message.text)
Exemple #2
0
    def run(self):
        update = self.update
        bot = self.bot
        
        if isDos(update): return
        if(not checkpermission(update)):   return
 
        # print('hi')
        chat_id = getID(update)
        text = 'hihi~~'    
        bot.send_message(chat_id, text)
        # update.message.reply_text(update.toString())
        appendlog(getID(update), update.message.from_user.full_name, update.message.text)
Exemple #3
0
    def run(self):
        update = self.update
        bot = self.bot

        if isDos(update): return
        if (not checkpermission(update)): return

        update.message.reply_text("備份中...")
        curMD.push(manual=True, hackmd=True)

        update.message.reply_text("手動備份完成")
        appendlog(getID(update), update.message.from_user.full_name,
                  update.message.text)
Exemple #4
0
    def run(self):
        update = self.update
        bot = self.bot
        
        if isDos(update): return
        if(not checkpermission(update)):   return

        update.message.reply_text("還原中...")
        # overwrite('filename_auto_back_up.txt')
        curData = Concat_Lines(read('filename.txt'))
        write('filename.txt', Concat_Lines(read('filename_auto_back_up.txt')))
        write('filename_auto_back_up.txt', curData)

        update.message.reply_text("以自動備份檔還原完成")

        appendlog(getID(update), update.message.from_user.full_name, update.message.text)
Exemple #5
0
    def run(self):
        update = self.update
        bot = self.bot

        if isDos(update): return
        if (not checkpermission(update)): return

        update.message.reply_text('備份中...')

        curMD.push(hackmd=True)

        if curMD.text == requests.get(
                'https://hackmd.io/Tz5EFYy-T-Sp9LqpvJkGLg'
        ).text.split(
                '<div id="doc" class="markdown-body container-fluid" data-hard-breaks="true">'
        )[1].split('</div>')[0]:
            update.message.reply_text('備份成功')
        else:
            update.message.reply_text('備份失敗')

        appendlog(getID(update), update.message.from_user.full_name,
                  update.message.text)
Exemple #6
0
    def run(self):
        update = self.update
        bot = self.bot

        if isDos(update): return
        if (not checkpermission(update)): return

        chat_id = getID(update)

        text = update.message.text.split()
        if len(text) > 2:
            update.message.reply_text('type error.')
        elif len(text) == 2:
            if not text[1].isdecimal():
                update.message.reply_text('type error.')
            else:
                singleReport(update, int(text[1]))
        else:
            for i in range(1, 4):
                singleReport(update, i)
        appendlog(getID(update), update.message.from_user.full_name,
                  update.message.text)
Exemple #7
0
    def run(self):
        update = self.update
        bot = self.bot

        if isDos(update): return
        if (not checkpermission(update)): return

        try:
            correct, wrong = update.message.text[len('/addtypo '):].split()
        except:
            update.message.reply_text('格式錯誤,請使用格式')
            update.message.reply_text('/addtypo 正確詞 錯誤詞')
            return
        r = read("typo.json")
        if correct in r: r[correct].append(wrong)
        else: r[correct] = [wrong]
        r = str(r)
        r = r.replace("\'", "\"")
        write("typo.json", r)
        update.message.reply_text("已新增")

        appendlog(getID(update), update.message.from_user.full_name,
                  update.message.text)