mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
Major command handling refactor
This commit is contained in:
parent
0869f94cdf
commit
f067485e88
15 changed files with 463 additions and 355 deletions
|
|
@ -1,9 +1,14 @@
|
|||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Tuple
|
||||
|
||||
from pluralkit import db, Member
|
||||
|
||||
|
||||
def fix_time(time: datetime):
|
||||
# Assume we're receiving a naive datetime set to UTC, returns naive time zone set to local
|
||||
return time.replace(tzinfo=timezone.utc).astimezone().replace(tzinfo=None)
|
||||
|
||||
|
||||
async def get_fronter_ids(conn, system_id) -> (List[int], datetime):
|
||||
switches = await db.front_history(conn, system_id=system_id, count=1)
|
||||
if not switches:
|
||||
|
|
@ -41,4 +46,4 @@ async def get_front_history(conn, system_id, count) -> List[Tuple[datetime, List
|
|||
timestamp = switch["timestamp"]
|
||||
members = [all_members[id] for id in switch["members"]]
|
||||
out.append((timestamp, members))
|
||||
return out
|
||||
return out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue