Files
twitch-subathon-plugin/subathon/data.py
2025-09-02 10:40:01 +10:00

62 lines
1.7 KiB
Python

from data import Registry, RowModel, Table
from data.columns import String, Timestamp, Integer, Bool
# User contributed {} subs and added {}:{} to the timer! Thank you :love:
# We have reached goal #5: Karaoke !! Thank you everyone for your support <3
class Subathon(RowModel):
_tablename_ = 'subathons'
_cache_ = {}
subathon_id = Integer(primary=True)
communityid = Integer()
started_at = Timestamp()
name = String()
initial_time = Integer() # Initial number of seconds
sub1_score = Integer()
sub2_score = Integer()
sub3_score = Integer()
bit_score = Integer()
score_time = Integer() # Conversion factor score to seconds
duration = Integer()
ended_at = Timestamp()
timecap = Integer() # Maximum subathon duration in seconds
class RunningSubathon(RowModel):
_tablename_ = 'running_subathons'
_cache_ = {}
subathon_id = Integer(primary=True)
last_started = Timestamp()
class SubathonContribution(RowModel):
_tablename_ = 'subathon_contributions'
_cache_ = {}
contribution_id = Integer(primary=True)
subathon_id = Integer()
profileid = Integer()
score = Integer()
event_id = Integer()
created_at = Timestamp()
class SubathonGoal(RowModel):
_tablename_ = 'subathon_goals'
_cache_ = {}
goal_id = Integer(primary=True)
subathon_id = Integer()
required_score = Integer()
description = String()
notified = Bool()
created_at = Timestamp()
class SubathonData(Registry):
VERSION = ('SUBATHON', 1)
subathons = Subathon.table
running_subathons = RunningSubathon.table
subathon_contributions = SubathonContribution.table
subathon_goals = SubathonGoal.table