Move System and Member to separate files
This commit is contained in:
parent
138c0b7f8c
commit
49b4e4c1ef
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
@ -1,48 +0,0 @@
|
||||
from collections import namedtuple
|
||||
from datetime import date, datetime
|
||||
|
||||
|
||||
class System(namedtuple("System", ["id", "hid", "name", "description", "tag", "avatar_url", "created"])):
|
||||
id: int
|
||||
hid: str
|
||||
name: str
|
||||
description: str
|
||||
tag: str
|
||||
avatar_url: str
|
||||
created: datetime
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"id": self.hid,
|
||||
"name": self.name,
|
||||
"description": self.description,
|
||||
"tag": self.tag,
|
||||
"avatar_url": self.avatar_url
|
||||
}
|
||||
|
||||
class Member(namedtuple("Member", ["id", "hid", "system", "color", "avatar_url", "name", "birthday", "pronouns", "description", "prefix", "suffix", "created"])):
|
||||
id: int
|
||||
hid: str
|
||||
system: int
|
||||
color: str
|
||||
avatar_url: str
|
||||
name: str
|
||||
birthday: date
|
||||
pronouns: str
|
||||
description: str
|
||||
prefix: str
|
||||
suffix: str
|
||||
created: datetime
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"id": self.hid,
|
||||
"name": self.name,
|
||||
"color": self.color,
|
||||
"avatar_url": self.avatar_url,
|
||||
"birthday": self.birthday.isoformat() if self.birthday else None,
|
||||
"pronouns": self.pronouns,
|
||||
"description": self.description,
|
||||
"prefix": self.prefix,
|
||||
"suffix": self.suffix
|
||||
}
|
@ -6,7 +6,9 @@ import re
|
||||
import traceback
|
||||
from typing import Tuple, Optional
|
||||
|
||||
from pluralkit import db, System, Member
|
||||
from pluralkit import db
|
||||
from pluralkit.system import System
|
||||
from pluralkit.member import Member
|
||||
from pluralkit.bot import embeds, utils
|
||||
|
||||
logger = logging.getLogger("pluralkit.bot.commands")
|
||||
|
@ -1,11 +1,12 @@
|
||||
import dateparser
|
||||
import humanize
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
import pluralkit.utils
|
||||
from pluralkit.bot import help
|
||||
from pluralkit.bot.commands import *
|
||||
from pluralkit.member import Member
|
||||
|
||||
logger = logging.getLogger("pluralkit.commands")
|
||||
|
||||
|
@ -6,7 +6,9 @@ import string
|
||||
import discord
|
||||
import humanize
|
||||
|
||||
from pluralkit import System, Member, db
|
||||
from pluralkit import db
|
||||
from pluralkit.system import System
|
||||
from pluralkit.member import Member
|
||||
from pluralkit.utils import get_fronters
|
||||
|
||||
logger = logging.getLogger("pluralkit.utils")
|
||||
|
@ -8,7 +8,9 @@ import asyncpg
|
||||
import asyncpg.exceptions
|
||||
from discord.utils import snowflake_time
|
||||
|
||||
from pluralkit import System, Member, stats
|
||||
from pluralkit import stats
|
||||
from pluralkit.system import System
|
||||
from pluralkit.member import Member
|
||||
|
||||
logger = logging.getLogger("pluralkit.db")
|
||||
async def connect(username, password, database, host, port):
|
||||
|
31
src/pluralkit/member.py
Normal file
31
src/pluralkit/member.py
Normal file
@ -0,0 +1,31 @@
|
||||
from datetime import date, datetime
|
||||
|
||||
from collections.__init__ import namedtuple
|
||||
|
||||
|
||||
class Member(namedtuple("Member", ["id", "hid", "system", "color", "avatar_url", "name", "birthday", "pronouns", "description", "prefix", "suffix", "created"])):
|
||||
id: int
|
||||
hid: str
|
||||
system: int
|
||||
color: str
|
||||
avatar_url: str
|
||||
name: str
|
||||
birthday: date
|
||||
pronouns: str
|
||||
description: str
|
||||
prefix: str
|
||||
suffix: str
|
||||
created: datetime
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"id": self.hid,
|
||||
"name": self.name,
|
||||
"color": self.color,
|
||||
"avatar_url": self.avatar_url,
|
||||
"birthday": self.birthday.isoformat() if self.birthday else None,
|
||||
"pronouns": self.pronouns,
|
||||
"description": self.description,
|
||||
"prefix": self.prefix,
|
||||
"suffix": self.suffix
|
||||
}
|
22
src/pluralkit/system.py
Normal file
22
src/pluralkit/system.py
Normal file
@ -0,0 +1,22 @@
|
||||
from datetime import datetime
|
||||
|
||||
from collections.__init__ import namedtuple
|
||||
|
||||
|
||||
class System(namedtuple("System", ["id", "hid", "name", "description", "tag", "avatar_url", "created"])):
|
||||
id: int
|
||||
hid: str
|
||||
name: str
|
||||
description: str
|
||||
tag: str
|
||||
avatar_url: str
|
||||
created: datetime
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
"id": self.hid,
|
||||
"name": self.name,
|
||||
"description": self.description,
|
||||
"tag": self.tag,
|
||||
"avatar_url": self.avatar_url
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Tuple
|
||||
|
||||
from pluralkit import db, Member
|
||||
from pluralkit import db
|
||||
from pluralkit.member import Member
|
||||
|
||||
|
||||
def fix_time(time: datetime):
|
||||
|
Loading…
Reference in New Issue
Block a user