[Fix] Incorrect json model for Guild Scheduled Event (#2813)

* fix some cringe

* whoooooooops
This commit is contained in:
Mihail Gribkov
2023-12-26 10:34:10 +03:00
committed by GitHub
parent d382e5cd48
commit de4b6b9f27
3 changed files with 5 additions and 8 deletions

View File

@@ -1,9 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Discord.API
{
@@ -16,7 +13,7 @@ namespace Discord.API
[JsonProperty("channel_id")]
public Optional<ulong?> ChannelId { get; set; }
[JsonProperty("creator_id")]
public Optional<ulong> CreatorId { get; set; }
public Optional<ulong?> CreatorId { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("description")]

View File

@@ -92,7 +92,7 @@ namespace Discord.Rest
Creator = RestUser.Create(Discord, model.Creator.Value);
}
CreatorId = model.CreatorId.ToNullable() ?? 0; // should be changed?
CreatorId = model.CreatorId.GetValueOrDefault(null) ?? 0; // should be changed?
ChannelId = model.ChannelId.IsSpecified ? model.ChannelId.Value : null;
Name = model.Name;
Description = model.Description.GetValueOrDefault();

View File

@@ -87,7 +87,7 @@ namespace Discord.WebSocket
if (model.CreatorId.IsSpecified)
{
var guildUser = Guild.GetUser(model.CreatorId.Value);
var guildUser = Guild.GetUser(model.CreatorId.GetValueOrDefault(0) ?? 0);
if (guildUser != null)
{
@@ -96,7 +96,7 @@ namespace Discord.WebSocket
Creator = guildUser;
}
else if (guildUser == null && model.Creator.IsSpecified)
else if (model.Creator.IsSpecified)
{
guildUser = SocketGuildUser.Create(Guild, Discord.State, model.Creator.Value);
Creator = guildUser;