Files
tbd-station-14/Content.Shared/CCVar/CCVars.Discord.cs
ssdaniel24 9881528692 Station news Discord webhook (#36807)
* Add news article Discord webhook

* Send all station articles on round end

* Changed event subscrice to RoundEndMessageEvent

* Review remarks fix

* Added new cvar discord.news_webhook_embed_color

Default color taken from news manager console sprite.

* Using EntityQueryEnumerator instead of GetStationInMap with TryComp

* Extra review remarks fixing

* Sorted imports

* Added article publication time in embed

* Removed markup from article content

* Added sorting for articles iteration

* Discord hook embed color cvar is string now

* Added comment about limits

* Added new cvar for posting articles during round

* Shitty discord rate limit handling

* Fixing copypaste accident

Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>

* Null initialization of webhook id

* SendArticleToDiscordWebhook is non-void now

---------

Co-authored-by: Morb0 <14136326+Morb0@users.noreply.github.com>
Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>
2025-05-10 11:21:02 -07:00

97 lines
4.4 KiB
C#

using Robust.Shared.Configuration;
using Robust.Shared.Maths;
namespace Content.Shared.CCVar;
public sealed partial class CCVars
{
/// <summary>
/// The role that will get mentioned if a new SOS ahelp comes in.
/// </summary>
public static readonly CVarDef<string> DiscordAhelpMention =
CVarDef.Create("discord.on_call_ping", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// URL of the discord webhook to relay unanswered ahelp messages.
/// </summary>
public static readonly CVarDef<string> DiscordOnCallWebhook =
CVarDef.Create("discord.on_call_webhook", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// URL of the Discord webhook which will relay all ahelp messages.
/// </summary>
public static readonly CVarDef<string> DiscordAHelpWebhook =
CVarDef.Create("discord.ahelp_webhook", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// The server icon to use in the Discord ahelp embed footer.
/// Valid values are specified at https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure.
/// </summary>
public static readonly CVarDef<string> DiscordAHelpFooterIcon =
CVarDef.Create("discord.ahelp_footer_icon", string.Empty, CVar.SERVERONLY);
/// <summary>
/// The avatar to use for the webhook. Should be an URL.
/// </summary>
public static readonly CVarDef<string> DiscordAHelpAvatar =
CVarDef.Create("discord.ahelp_avatar", string.Empty, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will relay all custom votes. If left empty, disables the webhook.
/// </summary>
public static readonly CVarDef<string> DiscordVoteWebhook =
CVarDef.Create("discord.vote_webhook", string.Empty, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will relay all votekick votes. If left empty, disables the webhook.
/// </summary>
public static readonly CVarDef<string> DiscordVotekickWebhook =
CVarDef.Create("discord.votekick_webhook", string.Empty, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will relay round restart messages.
/// </summary>
public static readonly CVarDef<string> DiscordRoundUpdateWebhook =
CVarDef.Create("discord.round_update_webhook", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// Role id for the Discord webhook to ping when the round ends.
/// </summary>
public static readonly CVarDef<string> DiscordRoundEndRoleWebhook =
CVarDef.Create("discord.round_end_role", string.Empty, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will relay watchlist connection notifications. If left empty, disables the webhook.
/// </summary>
public static readonly CVarDef<string> DiscordWatchlistConnectionWebhook =
CVarDef.Create("discord.watchlist_connection_webhook", string.Empty, CVar.SERVERONLY | CVar.CONFIDENTIAL);
/// <summary>
/// How long to buffer watchlist connections for, in seconds.
/// All connections within this amount of time from the first one will be batched and sent as a single
/// Discord notification. If zero, always sends a separate notification for each connection (not recommended).
/// </summary>
public static readonly CVarDef<float> DiscordWatchlistConnectionBufferTime =
CVarDef.Create("discord.watchlist_connection_buffer_time", 5f, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will receive station news acticles at the round end.
/// If left empty, disables the webhook.
/// </summary>
public static readonly CVarDef<string> DiscordNewsWebhook =
CVarDef.Create("discord.news_webhook", string.Empty, CVar.SERVERONLY);
/// <summary>
/// HEX color of station news discord webhook's embed.
/// </summary>
public static readonly CVarDef<string> DiscordNewsWebhookEmbedColor =
CVarDef.Create("discord.news_webhook_embed_color", Color.LawnGreen.ToHex(), CVar.SERVERONLY);
/// <summary>
/// Whether or not articles should be sent mid-round instead of all at once at the round's end
/// </summary>
public static readonly CVarDef<bool> DiscordNewsWebhookSendDuringRound =
CVarDef.Create("discord.news_webhook_send_during_round", false, CVar.SERVERONLY);
}