mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-25 23:49:11 +00:00
🐛 修复 sign
自动签到添加问题
This commit is contained in:
parent
44e13edced
commit
ccbcfedfa7
@ -3,6 +3,7 @@ import time
|
||||
|
||||
from aiohttp import ClientConnectorError
|
||||
from genshin import Game, GenshinException, AlreadyClaimed, InvalidCookies
|
||||
from telegram.constants import ParseMode
|
||||
from telegram.error import BadRequest, Forbidden
|
||||
from telegram.ext import CallbackContext, JobQueue
|
||||
|
||||
@ -80,8 +81,10 @@ class SignJob:
|
||||
except BaseException as exc:
|
||||
Log.error(f"执行自动签到时发生错误", exc)
|
||||
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:
|
||||
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:
|
||||
Log.error(f"执行自动签到时发生错误", exc)
|
||||
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.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.services import UserService
|
||||
from logger import Log
|
||||
@ -99,7 +99,7 @@ class Sign(BasePlugins):
|
||||
elif method == "关闭":
|
||||
return "您还没有开启自动签到"
|
||||
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)
|
||||
return "开启自动签到成功"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user