[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 Newtonsoft.Json;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Discord.API
|
namespace Discord.API
|
||||||
{
|
{
|
||||||
@@ -16,7 +13,7 @@ namespace Discord.API
|
|||||||
[JsonProperty("channel_id")]
|
[JsonProperty("channel_id")]
|
||||||
public Optional<ulong?> ChannelId { get; set; }
|
public Optional<ulong?> ChannelId { get; set; }
|
||||||
[JsonProperty("creator_id")]
|
[JsonProperty("creator_id")]
|
||||||
public Optional<ulong> CreatorId { get; set; }
|
public Optional<ulong?> CreatorId { get; set; }
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[JsonProperty("description")]
|
[JsonProperty("description")]
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Discord.Rest
|
|||||||
Creator = RestUser.Create(Discord, model.Creator.Value);
|
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;
|
ChannelId = model.ChannelId.IsSpecified ? model.ChannelId.Value : null;
|
||||||
Name = model.Name;
|
Name = model.Name;
|
||||||
Description = model.Description.GetValueOrDefault();
|
Description = model.Description.GetValueOrDefault();
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
if (model.CreatorId.IsSpecified)
|
if (model.CreatorId.IsSpecified)
|
||||||
{
|
{
|
||||||
var guildUser = Guild.GetUser(model.CreatorId.Value);
|
var guildUser = Guild.GetUser(model.CreatorId.GetValueOrDefault(0) ?? 0);
|
||||||
|
|
||||||
if (guildUser != null)
|
if (guildUser != null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ namespace Discord.WebSocket
|
|||||||
|
|
||||||
Creator = guildUser;
|
Creator = guildUser;
|
||||||
}
|
}
|
||||||
else if (guildUser == null && model.Creator.IsSpecified)
|
else if (model.Creator.IsSpecified)
|
||||||
{
|
{
|
||||||
guildUser = SocketGuildUser.Create(Guild, Discord.State, model.Creator.Value);
|
guildUser = SocketGuildUser.Create(Guild, Discord.State, model.Creator.Value);
|
||||||
Creator = guildUser;
|
Creator = guildUser;
|
||||||
|
|||||||
Reference in New Issue
Block a user