Made Veadotube redemptions more user friendly

This commit is contained in:
Tom
2024-12-03 02:39:27 +00:00
parent ea0550e99f
commit 850c09cfff
6 changed files with 115 additions and 16 deletions

View File

@ -52,7 +52,8 @@ namespace TwitchChatTTS.Twitch.Redemptions
_isReady = false;
var topic = _bus.GetTopic("redemptions_initiation");
topic.Subscribe(new ServiceBusObserver(data => {
topic.Subscribe(new ServiceBusObserver(data =>
{
if (data.Value is RedemptionInitiation obj)
Initialize(obj.Redemptions, obj.Actions);
}, _logger));
@ -225,14 +226,35 @@ namespace TwitchChatTTS.Twitch.Redemptions
await _nightbot.ClearQueue();
break;
case "VEADOTUBE_SET_STATE":
await _veado.SetCurrentState(action.Data["state"]);
break;
{
var state = _veado.GetStateId(action.Data["state"]);
if (state == null) {
_logger.Warning($"Could not find the state named '{action.Data["state"]}'.");
break;
}
await _veado.SetCurrentState(state);
break;
}
case "VEADOTUBE_PUSH_STATE":
await _veado.PushState(action.Data["state"]);
break;
{
var state = _veado.GetStateId(action.Data["state"]);
if (state == null) {
_logger.Warning($"Could not find the state named '{action.Data["state"]}'.");
break;
}
await _veado.PushState(state);
break;
}
case "VEADOTUBE_POP_STATE":
await _veado.PopState(action.Data["state"]);
break;
{
var state = _veado.GetStateId(action.Data["state"]);
if (state == null) {
_logger.Warning($"Could not find the state named '{action.Data["state"]}'.");
break;
}
await _veado.PopState(state);
break;
}
default:
_logger.Warning($"Unknown redeemable action has occured. Update needed? [type: {action.Type}][chatter: {senderDisplayName}][chatter id: {senderId}]");
break;