添加了docker支持
This commit is contained in:
parent
c11e2d8d6a
commit
71fb626c14
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 使用官方 Python 3.11 镜像
|
||||||
|
FROM python:3.11
|
||||||
|
|
||||||
|
# 将应用代码复制到 /app 目录下
|
||||||
|
COPY src/change_url /app
|
||||||
|
COPY requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 安装 Python 依赖
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
# 设置容器启动时执行的命令
|
||||||
|
CMD ["python", "change_url_bot.py"]
|
||||||
|
|
||||||
|
# 设置健康检查
|
||||||
|
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
|
||||||
|
CMD pgrep -f change_url_bot.py || exit 1
|
@ -1,16 +1,49 @@
|
|||||||
aiohttp==3.9.1
|
aiohttp==3.9.1
|
||||||
|
aiosignal==1.3.1
|
||||||
|
altgraph==0.17.4
|
||||||
|
annotated-types==0.6.0
|
||||||
|
anyio==4.3.0
|
||||||
|
attrs==23.2.0
|
||||||
cachetools==5.3.2
|
cachetools==5.3.2
|
||||||
|
certifi==2024.2.2
|
||||||
|
charset-normalizer==3.3.2
|
||||||
|
click==8.1.7
|
||||||
|
colorama==0.4.6
|
||||||
|
fastapi==0.110.1
|
||||||
|
frozenlist==1.4.1
|
||||||
|
greenlet==3.0.1
|
||||||
|
h11==0.14.0
|
||||||
|
idna==3.6
|
||||||
|
Jinja2==3.1.3
|
||||||
loguru==0.7.2
|
loguru==0.7.2
|
||||||
|
MarkupSafe==2.1.5
|
||||||
|
multidict==6.0.5
|
||||||
|
mysql-connector-python==8.3.0
|
||||||
|
packaging==24.0
|
||||||
|
pefile==2023.2.7
|
||||||
pika==1.3.2
|
pika==1.3.2
|
||||||
playwright==1.40.0
|
playwright==1.40.0
|
||||||
|
pydantic==2.7.0
|
||||||
|
pydantic_core==2.18.1
|
||||||
|
pyee==11.0.1
|
||||||
|
pyinstaller==6.5.0
|
||||||
|
pyinstaller-hooks-contrib==2024.3
|
||||||
PyQt6==6.6.1
|
PyQt6==6.6.1
|
||||||
PyQt6_sip==13.6.0
|
PyQt6-Qt6==6.6.2
|
||||||
|
PyQt6-sip==13.6.0
|
||||||
pyTelegramBotAPI==4.15.2
|
pyTelegramBotAPI==4.15.2
|
||||||
python_dateutil==2.8.2
|
python-dateutil==2.8.2
|
||||||
qdarkstyle==3.2.3
|
pywin32-ctypes==0.2.2
|
||||||
qtpy==2.4.1
|
QDarkStyle==3.2.3
|
||||||
|
QtPy==2.4.1
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
schedule==1.2.1
|
schedule==1.2.1
|
||||||
|
six==1.16.0
|
||||||
|
sniffio==1.3.1
|
||||||
SQLAlchemy==2.0.25
|
SQLAlchemy==2.0.25
|
||||||
|
starlette==0.37.2
|
||||||
typing_extensions==4.9.0
|
typing_extensions==4.9.0
|
||||||
mysql-connector-python==8.3.0
|
urllib3==2.2.1
|
||||||
|
uvicorn==0.29.0
|
||||||
|
win32-setctime==1.1.0
|
||||||
|
yarl==1.9.4
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
import telebot
|
import telebot
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from src.change_url.change_url import change_url
|
BOT_TOKEN = os.getenv('BOT_TOKEN', default="6356456493:AAF2J03isyhlOFF6WgoovRCzuvHheTrTKmM")
|
||||||
|
API_URL = os.getenv('API_URL', default="http://127.0.0.1:8080/changeurl")
|
||||||
|
|
||||||
TOKEN = '6356456493:AAF2J03isyhlOFF6WgoovRCzuvHheTrTKmM'
|
logger.debug(f"bot_token:{BOT_TOKEN}")
|
||||||
bot = telebot.TeleBot(TOKEN)
|
logger.debug(f"api_url:{API_URL}")
|
||||||
|
|
||||||
|
bot = telebot.TeleBot(BOT_TOKEN)
|
||||||
ky = ['技术客服域名值班']
|
ky = ['技术客服域名值班']
|
||||||
hth = ['YYZBH②拒绝私聊', '3-信息同步频道']
|
hth = ['YYZBH②拒绝私聊', '3-信息同步频道']
|
||||||
|
|
||||||
@ -35,7 +39,7 @@ def handle_forwarded_message(message):
|
|||||||
# user_info = message.forward_origin
|
# user_info = message.forward_origin
|
||||||
# response = f"这是一条转发的消息。{user_info}"
|
# response = f"这是一条转发的消息。{user_info}"
|
||||||
try:
|
try:
|
||||||
res = requests.post("http://127.0.0.1:8080/changeurl", params={'text': message.text})
|
res = requests.post(API_URL, json={'text': message.text})
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
if res.json()['res']:
|
if res.json()['res']:
|
||||||
msg = f'{res.json()["msg"]}修改成功'
|
msg = f'{res.json()["msg"]}修改成功'
|
||||||
@ -62,4 +66,3 @@ def start_polling():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
start_polling() # 开始长轮询
|
start_polling() # 开始长轮询
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user