diff --git a/Behavior/Ripcord.cs b/Behavior/Ripcord.cs new file mode 100644 index 0000000..c71c666 --- /dev/null +++ b/Behavior/Ripcord.cs @@ -0,0 +1,44 @@ +namespace vassago.Behavior; + +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using vassago.Models; + +[StaticPlz] +public class Ripcord: Behavior +{ + public override string Name => "Stop Button"; + + public override string Trigger => "!ripcord"; + + private static Guid uacID = new Guid("e00b0522-5ac1-46f2-b5e8-8b791692a746"); + private static UAC myUAC; + + public Ripcord() + { + myUAC = Rememberer.SearchUAC(uac => uac.OwnerId == uacID); + if (myUAC == null) + { + myUAC = new() + { + OwnerId = uacID, + DisplayName = Name, + Description = @"matching this means you can tell the bot to shutdown, now" + }; + } + Rememberer.RememberUAC(myUAC); + } + public override bool ShouldAct(Message message, List matchedUACs) + { + if (!base.ShouldAct(message, matchedUACs)) + return false; + return myUAC.Users.Contains(message.Author.IsUser); + } + + public override async Task ActOn(Message message) + { + Behaver.Instance.SendMessage(message.Channel.Id, "daisy, dai.. sy...."); + Shared.App.StopAsync(); + return true; + } +} diff --git a/Behavior/TwitchSummon.cs b/Behavior/TwitchSummon.cs index 0194b54..f5923ef 100644 --- a/Behavior/TwitchSummon.cs +++ b/Behavior/TwitchSummon.cs @@ -40,15 +40,10 @@ public class TwitchSummon : Behavior { if (!base.ShouldAct(message, matchedUACs)) return false; - var uacConf = Rememberer.SearchUAC(uac => uac.OwnerId == uacID); - if (uacConf == null) - { - Console.Error.WriteLine("no UAC conf for TwitchSummon! Set one up!"); - } - Console.WriteLine($"uacConf: {uacConf} users: {uacConf?.Users?.Count()}. message author: {message?.Author}. has an IsUser: {message?.Author?.IsUser}."); - Console.WriteLine($"and therefore: {uacConf.Users.Contains(message.Author.IsUser)}"); - return uacConf.Users.Contains(message.Author.IsUser); + Console.WriteLine($"myUAC: {myUAC} users: {myUAC?.Users?.Count()}. message author: {message?.Author}. has an IsUser: {message?.Author?.IsUser}."); + Console.WriteLine($"and therefore: {myUAC.Users.Contains(message.Author.IsUser)}"); + return myUAC.Users.Contains(message.Author.IsUser); } public override async Task ActOn(Message message) diff --git a/Program.cs b/Program.cs index b8127d8..cab63e2 100644 --- a/Program.cs +++ b/Program.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Mvc.NewtonsoftJson; +using vassago; using vassago.Models; var builder = WebApplication.CreateBuilder(args); @@ -45,4 +46,6 @@ if (app.Environment.IsDevelopment()) app.UseDeveloperExceptionPage(); } +Shared.App = app; + app.Run(); diff --git a/Shared.cs b/Shared.cs index aebc76e..e64c4d3 100644 --- a/Shared.cs +++ b/Shared.cs @@ -11,6 +11,7 @@ public static class Shared public static string DBConnectionString { get; set; } public static HttpClient HttpClient { get; internal set; } = new HttpClient(); public static bool SetupSlashCommands { get; set; } - public static Uri API_URL {get;set;} + public static Uri API_URL { get; set; } public static List ProtocolList { get; set; } = new(); + public static WebApplication App { get; set; } } diff --git a/WebInterface/Views/UACs/Details.cshtml b/WebInterface/Views/UACs/Details.cshtml index 5e9e932..bb6e61c 100644 --- a/WebInterface/Views/UACs/Details.cshtml +++ b/WebInterface/Views/UACs/Details.cshtml @@ -37,24 +37,14 @@ Translations (@Model.Translations?.Count) - next will be iterating over a dictionary. All reference on the internet implies this should work. And I'm sick of trying to figure out why it doens't. + next would be iterating over a dictionary. All reference on the internet implies this should work. I'm sick of trying to figure out why it doesn't. razor says to me, so i say to you: go fuck yourself; edit the db manually. - @{ var i = 0; } - @foreach(var kvp in Model.Translations) - { - i++; - if(String.IsNullOrWhiteSpace(kvp.Key) || String.IsNullOrWhiteSpace(kvp.Value)) - { - continue; - } - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - } + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw("");
o_O
@@ -69,21 +59,13 @@ - @{ - var j = 0; - foreach(var kvp in Model.CommandAlterations.ToList()) - { - j++; - Html.Raw(j); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - Html.Raw(""); - j++; - } - } + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); + @Html.Raw(""); +
o_O
o_O