mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 12:51:35 +00:00
添加 service.admin
admin重复时警告日记
This commit is contained in:
parent
7c48eb842d
commit
a0d17b1394
@ -1,8 +1,10 @@
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
from pymysql import IntegrityError
|
||||
|
||||
from config import config
|
||||
from logger import Log
|
||||
from service.repository import AsyncRepository
|
||||
from service.cache import RedisCache
|
||||
|
||||
@ -25,7 +27,8 @@ class AdminService:
|
||||
async def add_admin(self, user_id: int) -> bool:
|
||||
try:
|
||||
await self.repository.add_admin(user_id)
|
||||
except IntegrityError:
|
||||
except IntegrityError as error:
|
||||
Log.warning(f"{user_id} 已经存在数据库 \n", error)
|
||||
pass
|
||||
admin_list = await self.repository.get_admin()
|
||||
for config_admin in config.ADMINISTRATORS:
|
||||
|
Loading…
Reference in New Issue
Block a user