tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
DiscordConnectionStringBuilder.cs
Go to the documentation of this file.
1using System;
2using System.Linq;
3
5
7{
12 {
14 public override bool Valid => !String.IsNullOrEmpty(BotToken);
15
20 public string? BotToken { get; set; }
21
25 public bool DeploymentBranding { get; set; }
26
31
35 readonly bool unusedFlag;
36
43
48 public DiscordConnectionStringBuilder(string connectionString)
49 {
50 if (connectionString == null)
51 throw new ArgumentNullException(nameof(connectionString));
52
53 var splits = connectionString.Split(';');
54
55 BotToken = splits.First();
56
57 if (splits.Length < 2 || !Enum.TryParse<DiscordDMOutputDisplayType>(splits[1], out var dMOutputDisplayType))
58 dMOutputDisplayType = DiscordDMOutputDisplayType.Always;
59 DMOutputDisplay = dMOutputDisplayType;
60
61 if (splits.Length > 2 && Int32.TryParse(splits[2], out Int32 basedMeme))
62 unusedFlag = Convert.ToBoolean(basedMeme);
63
64 if (splits.Length > 3 && Int32.TryParse(splits[3], out Int32 branding))
65 DeploymentBranding = Convert.ToBoolean(branding);
66 else
67 DeploymentBranding = true; // previous default behaviour
68 }
69
71 public override string ToString() => $"{BotToken};{(int)DMOutputDisplay};{Convert.ToInt32(unusedFlag)};{Convert.ToInt32(DeploymentBranding)}";
72 }
73}
ChatConnectionStringBuilder for ChatProvider.Discord.
bool DeploymentBranding
If the tgstation-server logo is shown in deployment embeds.
readonly bool unusedFlag
Currently unused. Note its origin in based meme before repurposing.
DiscordConnectionStringBuilder()
Initializes a new instance of the DiscordConnectionStringBuilder class.
DiscordDMOutputDisplayType DMOutputDisplay
The DiscordDMOutputDisplayType.
DiscordConnectionStringBuilder(string connectionString)
Initializes a new instance of the DiscordConnectionStringBuilder class.
Helper for building ChatBotSettings.ConnectionStrings.
DiscordDMOutputDisplayType
When the DM output section of Discord deployment embeds should be shown.