mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 07:04:57 +01:00
Merge pull request #1402 from tgstation/1332-DeploymentBranding
Add option to disable branding on deployment embed
This commit is contained in:
+3
-3
@@ -5,9 +5,9 @@
|
||||
<PropertyGroup>
|
||||
<TgsCoreVersion>5.2.0</TgsCoreVersion>
|
||||
<TgsConfigVersion>4.4.0</TgsConfigVersion>
|
||||
<TgsApiVersion>9.6.0</TgsApiVersion>
|
||||
<TgsApiLibraryVersion>10.0.0</TgsApiLibraryVersion>
|
||||
<TgsClientVersion>11.0.0</TgsClientVersion>
|
||||
<TgsApiVersion>9.7.0</TgsApiVersion>
|
||||
<TgsApiLibraryVersion>10.1.0</TgsApiLibraryVersion>
|
||||
<TgsClientVersion>11.1.0</TgsClientVersion>
|
||||
<TgsDmapiVersion>6.0.5</TgsDmapiVersion>
|
||||
<TgsInteropVersion>5.3.0</TgsInteropVersion>
|
||||
<TgsHostWatchdogVersion>1.2.0</TgsHostWatchdogVersion>
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace Tgstation.Server.Api.Models
|
||||
/// </summary>
|
||||
public bool BasedMeme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the tgstation-server logo is shown in deployment embeds.
|
||||
/// </summary>
|
||||
public bool DeploymentBranding { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DiscordDMOutputDisplayType"/>.
|
||||
/// </summary>
|
||||
@@ -47,21 +52,25 @@ namespace Tgstation.Server.Api.Models
|
||||
throw new ArgumentNullException(nameof(connectionString));
|
||||
|
||||
var splits = connectionString.Split(';');
|
||||
|
||||
BotToken = splits.First();
|
||||
|
||||
if (splits.Length < 2 || !Enum.TryParse<DiscordDMOutputDisplayType>(splits[1], out var dMOutputDisplayType))
|
||||
dMOutputDisplayType = DiscordDMOutputDisplayType.Always;
|
||||
DMOutputDisplay = dMOutputDisplayType;
|
||||
|
||||
if (splits.Length > 2 && Int32.TryParse(splits[2], out Int32 basedMeme))
|
||||
{
|
||||
BasedMeme = Convert.ToBoolean(basedMeme);
|
||||
}
|
||||
else
|
||||
{
|
||||
BasedMeme = true; // oranges said this needs to be true by default :pensive:
|
||||
}
|
||||
|
||||
if (splits.Length > 3 && Int32.TryParse(splits[3], out Int32 branding))
|
||||
DeploymentBranding = Convert.ToBoolean(branding);
|
||||
else
|
||||
DeploymentBranding = true; // previous default behaviour
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString() => $"{BotToken};{(int)DMOutputDisplay};{Convert.ToInt32(BasedMeme)}";
|
||||
public override string ToString() => $"{BotToken};{(int)DMOutputDisplay};{Convert.ToInt32(BasedMeme)};{Convert.ToInt32(DeploymentBranding)}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
|
||||
/// </summary>
|
||||
readonly bool basedMeme;
|
||||
|
||||
/// <summary>
|
||||
/// If the tgstation-server logo is shown in deployment embeds.
|
||||
/// </summary>
|
||||
readonly bool deploymentBranding;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DiscordDMOutputDisplayType"/>.
|
||||
/// </summary>
|
||||
@@ -177,6 +182,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
|
||||
var botToken = csb.BotToken;
|
||||
basedMeme = csb.BasedMeme;
|
||||
outputDisplayType = csb.DMOutputDisplay;
|
||||
deploymentBranding = csb.DeploymentBranding;
|
||||
|
||||
serviceProvider = new ServiceCollection()
|
||||
.AddDiscordGateway(serviceProvider => botToken)
|
||||
@@ -282,13 +288,14 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
|
||||
localCommitPushed |= revisionInformation.CommitSha == revisionInformation.OriginCommitSha;
|
||||
|
||||
var fields = BuildUpdateEmbedFields(revisionInformation, byondVersion, gitHubOwner, gitHubRepo, localCommitPushed);
|
||||
var author = new EmbedAuthor(assemblyInformationProvider.VersionPrefix)
|
||||
{
|
||||
Url = "https://github.com/tgstation/tgstation-server",
|
||||
IconUrl = "https://avatars0.githubusercontent.com/u/1363778?s=280&v=4",
|
||||
};
|
||||
var embed = new Embed
|
||||
{
|
||||
Author = new EmbedAuthor(assemblyInformationProvider.VersionPrefix)
|
||||
{
|
||||
Url = "https://github.com/tgstation/tgstation-server",
|
||||
IconUrl = "https://avatars0.githubusercontent.com/u/1363778?s=280&v=4",
|
||||
},
|
||||
Author = deploymentBranding ? author : default,
|
||||
Colour = Color.FromArgb(0xF1, 0xC4, 0x0F),
|
||||
Description = "TGS has begun deploying active repository code to production.",
|
||||
Fields = fields,
|
||||
|
||||
Reference in New Issue
Block a user