Profile schema and discord hook

This commit is contained in:
2025-08-25 23:23:41 +10:00
parent fc3bdcbb5c
commit 5fa0df66f5
8 changed files with 307 additions and 0 deletions

81
profiles/data.py Normal file
View File

@@ -0,0 +1,81 @@
from data import Registry, Table, RowModel
from data.columns import String, Integer, Timestamp
class UserProfile(RowModel):
_tablename_ = 'user_profiles'
_cache_ = {}
profileid = Integer(primary=True)
nickname = String()
timezone = String()
locale_hint = String()
locale = String()
avatar = String()
migrated = Integer()
created_at = Timestamp()
last_seen = Timestamp()
_timestamp = Timestamp()
class DiscordProfileLink(RowModel):
_tablename_ = 'profiles_discord'
_cache_ = {}
linkid = Integer()
profileid = Integer()
userid = Integer(primary=True)
linked_at = Timestamp()
class TwitchProfileLink(RowModel):
_tablename_ = 'profiles_twitch'
_cache_ = {}
linkid = Integer()
profileid = Integer()
userid = String(primary=True)
linked_at = Timestamp()
class Community(RowModel):
_tablename_ = 'communities'
_cache_ = {}
communityid = Integer(primary=True)
migrated = Integer()
created_at = Timestamp()
last_seen = Timestamp()
_timestamp = Timestamp()
class DiscordCommunityLink(RowModel):
_tablename_ = 'communities_discord'
_cache_ = {}
linkid = Integer()
guildid = Integer(primary=True)
communityid = Integer()
linked_at = Timestamp()
class TwitchCommunityLink(RowModel):
_tablename_ = 'communities_twitch'
_cache_ = {}
linkid = Integer()
channelid = String(primary=True)
communityid = Integer()
linked_at = Timestamp()
class ProfilesData(Registry):
VERSION = ('PROFILES', 1)
user_profiles = UserProfile.table
profiles_discord = DiscordProfileLink.table
profiles_twitch = TwitchProfileLink.table
communities = Community.table
communities_discord = DiscordCommunityLink.table
communities_twitch = TwitchCommunityLink.table