[Fix] Incorrect json model for Guild Scheduled Event (#2813)
* fix some cringe * whoooooooops
This commit is contained in:
@@ -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")]
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user