nb_log icon indicating copy to clipboard operation
nb_log copied to clipboard

新特性请求:增加向telegram推送日志

Open owiofwm2i opened this issue 3 years ago • 2 comments

你好:因为tg使用更加简单,请求添加一个tg的日志推送模块 如: tg_bot_token:telegram的bot token tg_user_id:telegram的用户id:

sync请求示例:

import requests
TG_USER_ID=tg_user_id
TG_BOT_TOKEN=tg_bot_token
TG_API_HOST = 'api.telegram.org'
def telegram(log_detail:str):
    data = (('chat_id', TG_USER_ID), ('text', 'nb_log日志推送 \n\n' + log_detail:str))
    response = requests.post('https://' + TG_API_HOST + '/bot' + TG_BOT_TOKEN +
                             '/sendMessage',
                             data=data)
    if response.status_code != 200:
        print('Telegram Bot 推送失败')
    else:
        print('Telegram Bot 推送成功')

owiofwm2i avatar Mar 20 '22 15:03 owiofwm2i

telegram国内能用吗?

ydf0509 avatar Mar 21 '22 02:03 ydf0509

可以搭建一个转发,再说也不一定都是国内用这个库啊

owiofwm2i avatar Mar 22 '22 18:03 owiofwm2i