mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-29 17:11:44 +00:00
🐛 修复 sign
自动签到添加问题
This commit is contained in:
parent
44e13edced
commit
ccbcfedfa7
@ -3,6 +3,7 @@ import time
|
|||||||
|
|
||||||
from aiohttp import ClientConnectorError
|
from aiohttp import ClientConnectorError
|
||||||
from genshin import Game, GenshinException, AlreadyClaimed, InvalidCookies
|
from genshin import Game, GenshinException, AlreadyClaimed, InvalidCookies
|
||||||
|
from telegram.constants import ParseMode
|
||||||
from telegram.error import BadRequest, Forbidden
|
from telegram.error import BadRequest, Forbidden
|
||||||
from telegram.ext import CallbackContext, JobQueue
|
from telegram.ext import CallbackContext, JobQueue
|
||||||
|
|
||||||
@ -80,8 +81,10 @@ class SignJob:
|
|||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
Log.error(f"执行自动签到时发生错误", exc)
|
Log.error(f"执行自动签到时发生错误", exc)
|
||||||
continue
|
continue
|
||||||
|
if sign_db.chat_id < 0:
|
||||||
|
text = f"<a href=\"tg://user?id={sign_db.user_id}\">NOTICE {sign_db.user_id}</a>\n\n{text}"
|
||||||
try:
|
try:
|
||||||
await context.bot.send_message(sign_db.chat_id, text)
|
await context.bot.send_message(sign_db.chat_id, text, parse_mode=ParseMode.HTML)
|
||||||
except BadRequest as exc:
|
except BadRequest as exc:
|
||||||
Log.error(f"执行自动签到时发生错误", exc)
|
Log.error(f"执行自动签到时发生错误", exc)
|
||||||
sign_db.status = SignStatusEnum.BAD_REQUEST
|
sign_db.status = SignStatusEnum.BAD_REQUEST
|
||||||
|
@ -7,7 +7,7 @@ from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, fi
|
|||||||
|
|
||||||
from apps.cookies.services import CookiesService
|
from apps.cookies.services import CookiesService
|
||||||
from apps.sign.services import SignServices
|
from apps.sign.services import SignServices
|
||||||
from apps.sign.models import Sign as SignUser
|
from apps.sign.models import Sign as SignUser, SignStatusEnum
|
||||||
from apps.user.repositories import UserNotFoundError
|
from apps.user.repositories import UserNotFoundError
|
||||||
from apps.user.services import UserService
|
from apps.user.services import UserService
|
||||||
from logger import Log
|
from logger import Log
|
||||||
@ -99,7 +99,7 @@ class Sign(BasePlugins):
|
|||||||
elif method == "关闭":
|
elif method == "关闭":
|
||||||
return "您还没有开启自动签到"
|
return "您还没有开启自动签到"
|
||||||
elif method == "开启":
|
elif method == "开启":
|
||||||
user = SignUser(user_id=user_id, chat_id=chat_id)
|
user = SignUser(user_id=user_id, chat_id=chat_id, status=SignStatusEnum.STATUS_SUCCESS)
|
||||||
await self.sign_service.add(user)
|
await self.sign_service.add(user)
|
||||||
return "开启自动签到成功"
|
return "开启自动签到成功"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user