mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-09 23:37:54 +00:00
Refactor member actions into members.py
This commit is contained in:
parent
05cf04df03
commit
cae394b4e8
7 changed files with 214 additions and 109 deletions
|
|
@ -8,7 +8,6 @@ from urllib.parse import urlparse
|
|||
|
||||
from pluralkit import db
|
||||
from pluralkit.errors import InvalidAvatarURLError
|
||||
from pluralkit.member import Member
|
||||
|
||||
|
||||
def fix_time(time: datetime):
|
||||
|
|
@ -27,7 +26,7 @@ async def get_fronter_ids(conn, system_id) -> (List[int], datetime):
|
|||
return switches[0]["members"], switches[0]["timestamp"]
|
||||
|
||||
|
||||
async def get_fronters(conn, system_id) -> (List[Member], datetime):
|
||||
async def get_fronters(conn, system_id) -> (List["Member"], datetime):
|
||||
member_ids, timestamp = await get_fronter_ids(conn, system_id)
|
||||
|
||||
# Collect in dict and then look up as list, to preserve return order
|
||||
|
|
@ -35,7 +34,7 @@ async def get_fronters(conn, system_id) -> (List[Member], datetime):
|
|||
return [members[member_id] for member_id in member_ids], timestamp
|
||||
|
||||
|
||||
async def get_front_history(conn, system_id, count) -> List[Tuple[datetime, List[Member]]]:
|
||||
async def get_front_history(conn, system_id, count) -> List[Tuple[datetime, List["pluMember"]]]:
|
||||
# Get history from DB
|
||||
switches = await db.front_history(conn, system_id=system_id, count=count)
|
||||
if not switches:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue