Skip to content

Commit

Permalink
chore: 项目启动时打印WeChatter艺术字
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassius0924 committed Feb 19, 2024
1 parent b22dfac commit 4da3f24
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# WeChatter 启动文件
#
# __ __ ______ ______ __ __ ______ ______ ______ ______ ______
# /\ \ _ \ \ /\ ___\ /\ ___\ /\ \_\ \ /\ __ \ /\__ _\/\__ _\/\ ___\ /\ == \
# \ \ \/ ".\ \\ \ __\ \ \ \____\ \ __ \\ \ __ \\/_/\ \/\/_/\ \/\ \ __\ \ \ __<
# \ \__/".~\_\\ \_____\\ \_____\\ \_\ \_\\ \_\ \_\ \ \_\ \ \_\ \ \_____\\ \_\ \_\
# \/_/ \/_/ \/_____/ \/_____/ \/_/\/_/ \/_/\/_/ \/_/ \/_/ \/_____/ \/_/ /_/
#

import uvicorn
from loguru import logger

import wechatter.database as db
import wechatter.utils.file_manager as fm
Expand Down Expand Up @@ -28,7 +35,6 @@ def main():

db.create_tables()

logger.info("WeChatter 启动成功!")
# 启动uvicorn
uvicorn.run(app, host="0.0.0.0", port=config.wechatter_port)

Expand Down
Empty file added wechatter/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions wechatter/app/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from fastapi import FastAPI
from loguru import logger

import wechatter.app.routers as routers
import wechatter.config as config
from wechatter.art_text import print_wechatter_art_text
from wechatter.config.parsers import (
parse_gasoline_price_cron_rule_list,
parse_weather_cron_rule_list,
Expand Down Expand Up @@ -33,6 +35,8 @@
@app.on_event("startup")
async def startup_event():
scheduler.startup()
print_wechatter_art_text()
logger.info("WeChatter 启动成功!")

@app.on_event("shutdown")
async def shutdown_event():
Expand Down
35 changes: 35 additions & 0 deletions wechatter/art_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# WECHATTER_ART_TEXT0 = r'+-------------------------------------------------------------------------------------+'
# WECHATTER_ART_TEXT1 = r'| __ __ ______ ______ __ __ ______ ______ ______ ______ ______ |'
# WECHATTER_ART_TEXT2 = r'| /\ \ _ \ \ /\ ___\ /\ ___\ /\ \_\ \ /\ __ \ /\__ _\/\__ _\/\ ___\ /\ == \ |'
# WECHATTER_ART_TEXT3 = r'| \ \ \/ ".\ \\ \ __\ \ \ \____\ \ __ \\ \ __ \\/_/\ \/\/_/\ \/\ \ __\ \ \ __< |'
# WECHATTER_ART_TEXT4 = r'| \ \__/".~\_\\ \_____\\ \_____\\ \_\ \_\\ \_\ \_\ \ \_\ \ \_\ \ \_____\\ \_\ \_\ |'
# WECHATTER_ART_TEXT5 = r'| \/_/ \/_/ \/_____/ \/_____/ \/_/\/_/ \/_/\/_/ \/_/ \/_/ \/_____/ \/_/ /_/ |'
# WECHATTER_ART_TEXT6 = r'+-------------------------------------------------------------------------------------+'

WECHATTER_ART_TEXT = r"""
__ __ ______ ______ __ __ ______ ______ ______ ______ ______
/\ \ _ \ \ /\ ___\ /\ ___\ /\ \_\ \ /\ __ \ /\__ _\/\__ _\/\ ___\ /\ == \
\ \ \/ ".\ \\ \ __\ \ \ \____\ \ __ \\ \ __ \\/_/\ \/\/_/\ \/\ \ __\ \ \ __<
\ \__/".~\_\\ \_____\\ \_____\\ \_\ \_\\ \_\ \_\ \ \_\ \ \_\ \ \_____\\ \_\ \_\
\/_/ \/_/ \/_____/ \/_____/ \/_/\/_/ \/_/\/_/ \/_/ \/_/ \/_____/ \/_/ /_/
"""


def print_wechatter_art_text():
print(WECHATTER_ART_TEXT)


# print(WECHATTER_ART_TEXT0)
# print(WECHATTER_ART_TEXT1)
# print(WECHATTER_ART_TEXT2)
# print(WECHATTER_ART_TEXT3)
# print(WECHATTER_ART_TEXT4)
# print(WECHATTER_ART_TEXT5)
# print(WECHATTER_ART_TEXT6)
# print("\033[1;36m%s\033[0m" % WECHATTER_ART_TEXT0)
# print("\033[1;36m%s\033[0m" % WECHATTER_ART_TEXT1)
# print("\033[1;36m%s\033[0m" % WECHATTER_ART_TEXT2)
# print("\033[1;31m%s\033[0m" % WECHATTER_ART_TEXT3)
# print("\033[1;34m%s\033[0m" % WECHATTER_ART_TEXT4)
# print("\033[1;34m%s\033[0m" % WECHATTER_ART_TEXT5)
# print("\033[1;34m%s\033[0m" % WECHATTER_ART_TEXT6)

0 comments on commit 4da3f24

Please sign in to comment.