Updated Chatter
Use Dictionary for TwitchUser, and creation of TwitchUser from dictionary saved into the database. Added ignore_column() for user, as it's to be used only during runtime.
This commit is contained in:
parent
e586141d4d
commit
d6b5d2c1c2
1 changed files with 21 additions and 4 deletions
|
|
@ -14,23 +14,40 @@ enum ChatterLevel
|
|||
|
||||
@export var id: int
|
||||
@export var twitch_id: String
|
||||
@export var nickname: String = ""
|
||||
@export var user_data: Dictionary:
|
||||
set(value):
|
||||
user_data = value
|
||||
if user == null:
|
||||
user = TwitchUser.from_json(user_data)
|
||||
@export var first_added: float = 0.0
|
||||
@export var first_seen: float = 0.0
|
||||
@export var last_seen: float = 0.0
|
||||
@export var known_engine: String = ""
|
||||
@export var steam_games: Array[int] = []
|
||||
@export var itch_games: Dictionary[String, String] = {}
|
||||
@export var urls: Dictionary[String, String] = {}
|
||||
@export var is_indie_game_dev: bool = false
|
||||
@export var is_on_team: bool = false
|
||||
@export var level: ChatterLevel = ChatterLevel.NEW
|
||||
@export var is_streamer: bool = false
|
||||
@export var auto_shoutout: bool = false
|
||||
@export var shoutout_as_devteam: bool = false
|
||||
@export var promo_msg: String = ""
|
||||
@export var level: ChatterLevel = ChatterLevel.NEW
|
||||
@export var notes: String = ""
|
||||
@export var scores: Dictionary[String, int] = {}
|
||||
@export var extra_data: Dictionary[String, Variant] = {}
|
||||
@export var first_seen: float = 0.0
|
||||
@export var last_seen: float = 0.0
|
||||
@export var user: TwitchUser:
|
||||
get():
|
||||
if not user and user_data:
|
||||
user = TwitchUser.from_json(user_data)
|
||||
return user
|
||||
set(value):
|
||||
user = value
|
||||
if user:
|
||||
user_data = user.to_dict()
|
||||
|
||||
static func _setup() -> void:
|
||||
set_table_name(Chatter, "chatters")
|
||||
set_column_flags(Chatter, "id", Types.Flags.PRIMARY_KEY|Types.Flags.AUTO_INCREMENT|Types.Flags.NOT_NULL)
|
||||
set_column_flags(Chatter, "twitch_id", Types.Flags.NOT_NULL)
|
||||
ignore_column(Chatter, "user")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue