Fix invalid types for some discord webhook values (#19515)

This commit is contained in:
DrSmugleaf
2023-08-24 22:59:43 -07:00
committed by GitHub
parent 0326badcb7
commit 4daabaae05
4 changed files with 8 additions and 8 deletions

View File

@@ -144,7 +144,7 @@ namespace Content.Server.Administration.Systems
_config.UnsubValueChanged(CVars.GameHostName, OnServerNameChanged); _config.UnsubValueChanged(CVars.GameHostName, OnServerNameChanged);
} }
private void OnWebhookChanged(string url) private async void OnWebhookChanged(string url)
{ {
_webhookUrl = url; _webhookUrl = url;
@@ -173,7 +173,7 @@ namespace Content.Server.Administration.Systems
var webhookToken = match.Groups[2].Value; var webhookToken = match.Groups[2].Value;
// Fire and forget // Fire and forget
_ = SetWebhookData(webhookId, webhookToken); await SetWebhookData(webhookId, webhookToken);
} }
private async Task SetWebhookData(string id, string token) private async Task SetWebhookData(string id, string token)

View File

@@ -6,16 +6,16 @@ namespace Content.Server.Discord;
public struct WebhookData public struct WebhookData
{ {
[JsonPropertyName("id")] [JsonPropertyName("id")]
public ulong Id { get; set; } public string Id { get; set; }
[JsonPropertyName("type")] [JsonPropertyName("type")]
public int Type { get; set; } public int Type { get; set; }
[JsonPropertyName("guild_id")] [JsonPropertyName("guild_id")]
public ulong? GuildId { get; set; } public string? GuildId { get; set; }
[JsonPropertyName("channel_id")] [JsonPropertyName("channel_id")]
public ulong? ChannelId { get; set; } public string? ChannelId { get; set; }
[JsonPropertyName("user")] [JsonPropertyName("user")]
public WebhookUser? User { get; set; } public WebhookUser? User { get; set; }
@@ -30,7 +30,7 @@ public struct WebhookData
public string Token { get; set; } public string Token { get; set; }
[JsonPropertyName("application_id")] [JsonPropertyName("application_id")]
public ulong? ApplicationId { get; set; } public string? ApplicationId { get; set; }
[JsonPropertyName("url")] [JsonPropertyName("url")]
public string? Url { get; set; } public string? Url { get; set; }

View File

@@ -1,3 +1,3 @@
namespace Content.Server.Discord; namespace Content.Server.Discord;
public record struct WebhookIdentifier(ulong Id, string Token); public record struct WebhookIdentifier(string Id, string Token);

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Discord;
public struct WebhookUser public struct WebhookUser
{ {
[JsonPropertyName("id")] [JsonPropertyName("id")]
public ulong Id { get; set; } public string Id { get; set; }
[JsonPropertyName("username")] [JsonPropertyName("username")]
public string Username { get; set; } public string Username { get; set; }