65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
#! /usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import signal
|
|
from argparse import ArgumentParser
|
|
|
|
from configuration import Config
|
|
from constants import ChatType
|
|
from robot import Robot, __version__
|
|
from wcferry import Wcf
|
|
|
|
|
|
def main(chat_type: int):
|
|
config = Config()
|
|
wcf = Wcf(debug=True)
|
|
|
|
def handler(sig, frame):
|
|
wcf.cleanup() # 退出前清理环境
|
|
exit(0)
|
|
|
|
signal.signal(signal.SIGINT, handler)
|
|
|
|
robot = Robot(config, wcf, chat_type)
|
|
robot.LOG.info(f"WeChatRobot【{__version__}】成功启动···")
|
|
|
|
# 机器人启动发送测试消息
|
|
robot.send_text_msg("启动成功!", "filehelper")
|
|
|
|
# 接收消息
|
|
# robot.enableRecvMsg() # 可能会丢消息?
|
|
robot.enableReceivingMsg() # 加队列
|
|
|
|
# 每天 8:30 发送新闻
|
|
robot.onEveryTime("08:30", robot.news_baidu_report_auto)
|
|
|
|
# epic
|
|
robot.onEveryTime("10:30", robot.send_epic_free_games)
|
|
|
|
# message report 1:数据自动从redis 转到sqllite
|
|
robot.onEveryTime("00:30", robot.message_count_to_db)
|
|
# 从db中提取并发送给相关群
|
|
robot.onEveryTime("09:30", robot.generate_and_send_ranking)
|
|
|
|
# sehuatang
|
|
robot.onEveryTime("15:00", robot.generate_sehuatang_pdf)
|
|
|
|
# 游戏的定时任务每小时执行
|
|
robot.onEveryTime("18:00", robot.game_auto_tasks)
|
|
|
|
# 秀人网每天自动下载帖子
|
|
robot.onEveryTime("01:30", robot.xiu_ren_download_task)
|
|
|
|
# 秀人网每天自动发pdf
|
|
robot.onEveryTime("17:30", robot.xiu_ren_pdf_send)
|
|
|
|
# 让机器人一直跑
|
|
robot.keep_running_and_block_process()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = ArgumentParser()
|
|
parser.add_argument('-c', type=int, default=0, help=f'选择模型参数序号: {ChatType.help_hint()}')
|
|
args = parser.parse_args().c
|
|
main(args)
|