diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/pluralkit/__init__.py b/src/pluralkit/__init__.py index 0b12fe6d..e69de29b 100644 --- a/src/pluralkit/__init__.py +++ b/src/pluralkit/__init__.py @@ -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 - } \ No newline at end of file diff --git a/src/pluralkit/bot/commands/__init__.py b/src/pluralkit/bot/commands/__init__.py index 915fb9da..58c4a0c4 100644 --- a/src/pluralkit/bot/commands/__init__.py +++ b/src/pluralkit/bot/commands/__init__.py @@ -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") diff --git a/src/pluralkit/bot/commands/switch_commands.py b/src/pluralkit/bot/commands/switch_commands.py index f5edb6c3..75496013 100644 --- a/src/pluralkit/bot/commands/switch_commands.py +++ b/src/pluralkit/bot/commands/switch_commands.py @@ -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") diff --git a/src/pluralkit/bot/utils.py b/src/pluralkit/bot/utils.py index ddf1b1af..53b26ac0 100644 --- a/src/pluralkit/bot/utils.py +++ b/src/pluralkit/bot/utils.py @@ -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") diff --git a/src/pluralkit/db.py b/src/pluralkit/db.py index b0b8a982..57da29af 100644 --- a/src/pluralkit/db.py +++ b/src/pluralkit/db.py @@ -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): diff --git a/src/pluralkit/member.py b/src/pluralkit/member.py new file mode 100644 index 00000000..626623b2 --- /dev/null +++ b/src/pluralkit/member.py @@ -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 + } \ No newline at end of file diff --git a/src/pluralkit/system.py b/src/pluralkit/system.py new file mode 100644 index 00000000..93592645 --- /dev/null +++ b/src/pluralkit/system.py @@ -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 + } \ No newline at end of file diff --git a/src/pluralkit/utils.py b/src/pluralkit/utils.py index 2648ee98..7d459655 100644 --- a/src/pluralkit/utils.py +++ b/src/pluralkit/utils.py @@ -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):