コード例 #1
0
def logHandler(update, context):
    herokuHelper = HerokuHelper(Config.HEROKU_APP_NAME, Config.HEROKU_API_KEY)
    log = herokuHelper.getLog()
    if len(log) > Config.TG_CHARACTER_LIMIT:
        file = BytesIO(bytes(log, "utf-8"))
        file.name = "log.txt"
        update.message.reply_document(file)
    else:
        update.message.reply_text(log)
コード例 #2
0
def logHandler(update,context):
    sudo = list(Config.SUDO_USERS) + list(Config.SUPPORT_USERS) 
    message = update.effective_message
    user_id = message.from_user.id
    if int(user_id) in sudo:
        herokuHelper = HerokuHelper(Config.HEROKU_APP_NAME,Config.HEROKU_API_KEY)
        log = herokuHelper.getLog()
        if len(log) > Config.TG_CHARACTER_LIMIT:
            file = BytesIO(bytes(log,"utf-8"))
            file.name = "log.txt"
            update.message.reply_document(file)
        else:
            update.message.reply_text(log)
    else:
        message.reply_text(non_admin,parse_mode=ParseMode.HTML)