diff --git a/src/Tgstation.Server.Api/Models/DiscordConnectionStringBuilder.cs b/src/Tgstation.Server.Api/Models/DiscordConnectionStringBuilder.cs index 57fba95013..dc85593090 100644 --- a/src/Tgstation.Server.Api/Models/DiscordConnectionStringBuilder.cs +++ b/src/Tgstation.Server.Api/Models/DiscordConnectionStringBuilder.cs @@ -18,6 +18,11 @@ namespace Tgstation.Server.Api.Models /// See https://discordapp.com/developers/docs/topics/oauth2#bots public string? BotToken { get; set; } + /// + /// to enable based mode. Will auto reply with a youtube link to a video that says "based on the hardware that's installed in it" to anyone saying 'based on what?' case-insensitive. + /// + public bool BasedMeme { get; set; } + /// /// The . /// @@ -26,7 +31,10 @@ namespace Tgstation.Server.Api.Models /// /// Construct a /// - public DiscordConnectionStringBuilder() { } + public DiscordConnectionStringBuilder() + { + BasedMeme = true; + } /// /// Construct a from a @@ -42,9 +50,17 @@ namespace Tgstation.Server.Api.Models if (splits.Length < 2 || !Enum.TryParse(splits[1], out var dMOutputDisplayType)) dMOutputDisplayType = DiscordDMOutputDisplayType.Always; DMOutputDisplay = dMOutputDisplayType; + if (splits.Length > 1 && Int32.TryParse(splits[2], out Int32 basedMeme)) + { + BasedMeme = Convert.ToBoolean(basedMeme); + } + else + { + BasedMeme = true; // Oranges said this needs to be true by default :pensive: + } } /// - public override string ToString() => $"{BotToken};{(int)DMOutputDisplay}"; + public override string ToString() => $"{BotToken};{(int)DMOutputDisplay};{Convert.ToInt32(BasedMeme)}"; } } diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index d624c960d4..df097473ae 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -52,6 +52,11 @@ namespace Tgstation.Server.Host.Components.Chat.Providers /// readonly string botToken; + /// + /// to enable based mode. Will auto reply with a youtube link to a video that says "based on the hardware that's installed in it" to anyone saying 'based on what?' case-insensitive. + /// + readonly bool basedMeme; + /// /// The . /// @@ -82,6 +87,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers var csb = new DiscordConnectionStringBuilder(chatBot.ConnectionString); botToken = csb.BotToken; + basedMeme = csb.BasedMeme; outputDisplayType = csb.DMOutputDisplay; client = new DiscordSocketClient(); @@ -110,7 +116,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers void StartTyping() => typingState = e.Channel.EnterTypingState(); try { - if (e.Content.Equals("Based on what?", StringComparison.OrdinalIgnoreCase)) + if (basedMeme && e.Content.Equals("Based on what?", StringComparison.OrdinalIgnoreCase)) { StartTyping();