(streamalerts): Add new alert keys.

This commit is contained in:
2024-08-27 17:30:53 +10:00
parent 5de3fd77bf
commit 58c0873987
2 changed files with 17 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ class AlertEditorUI(MessageUI):
data.streamerid,
utc_now() - dt.timedelta(hours=1),
-1,
"Discord Admin",
"Art",
"Testing Go Live Message",
utc_now()
)

View File

@@ -47,6 +47,9 @@ class AlertSettings(SettingGroup):
'{login_name}': "Twitch channel login name (as in url)",
'{channel_link}': "Link to the live twitch channel",
'{stream_start}': "Numeric timestamp when stream went live",
'{stream_start_iso}': "ISO timestamp when stream went live (for embed timestamp)",
'{title}': "Title of the stream when it went live",
'{game}': "Game name of the stream when it went live"
}
# TODO: More stuff
@@ -71,13 +74,15 @@ class AlertSettings(SettingGroup):
'{login_name}': streamer.login_name,
'{channel_link}': f"https://www.twitch.tv/{streamer.login_name}",
'{stream_start}': int(stream.start_at.timestamp()),
'{stream_start_iso}': stream.start_at.isoformat(),
'{title}': stream.title,
'{game}': stream.game_name,
}
recurse_map(
return recurse_map(
lambda loc, value: replace_multiple(value, mapping) if isinstance(value, str) else value,
data_dict,
)
return data_dict
return formatter
async def editor_callback(self, editor_data):
@@ -127,7 +132,11 @@ class AlertSettings(SettingGroup):
'{login_name}': "Twitch channel login name (as in url)",
'{channel_link}': "Link to the live twitch channel",
'{stream_start}': "Numeric timestamp when stream went live",
'{stream_start_iso}': "ISO timestamp when stream went live (for embed timestamp)",
'{stream_end}': "Numeric timestamp when stream ended",
'{stream_end_iso}': "ISO timestamp when stream ended (for embed timestamp)",
'{title}': "Title of the stream when it went live",
'{game}': "Game name of the stream when it went live",
}
@property
@@ -156,13 +165,16 @@ class AlertSettings(SettingGroup):
'{channel_link}': f"https://www.twitch.tv/{streamer.login_name}",
'{stream_start}': int(stream.start_at.timestamp()),
'{stream_end}': int(stream.end_at.timestamp()),
'{stream_start_iso}': stream.start_at.isoformat(),
'{stream_end_iso}': stream.end_at.isoformat(),
'{title}': stream.title,
'{game}': stream.game_name,
}
recurse_map(
return recurse_map(
lambda loc, value: replace_multiple(value, mapping) if isinstance(value, str) else value,
data_dict,
)
return data_dict
return formatter
async def editor_callback(self, editor_data):