Info: Discord_GuildBanAdd(User user) gets called but user is null
Where the mistake is located:
WebSockets > SocketListener > method SocketMessage > switch payload.OpCode > case OpCodes.Dispatch > switch payload.EventName > case GUILD_BAN_ADD & GUILD_BAN_REMOVE
Solution:
both ban add and ban remove are getting user with payload.EventData.ToObject<User>(); but the content of payload.EventData is
"user": { "username": "username", "id": "someIDhere", "discriminator": "discriminatorHere", "avatar": null }, "guild_id": "guildIdHere"
Solution is simple, add a new DiscordObject and deserialize the payload.EventData into it, the class would have to look like this
class BanObject { public User user { get; set; } public string guild_id { get; set; } }
and then finally, user would be supplied like this
User bannedUser = payload.EventData.ToObject<BanObject>().user;
Info: Discord_GuildBanAdd(User user) gets called but user is null
Where the mistake is located: WebSockets > SocketListener > method SocketMessage > switch payload.OpCode > case OpCodes.Dispatch > switch payload.EventName > case GUILD_BAN_ADD & GUILD_BAN_REMOVE
Solution: both ban add and ban remove are getting user with
payload.EventData.ToObject<User>();
but the content of payload.EventData is"user": { "username": "username", "id": "someIDhere", "discriminator": "discriminatorHere", "avatar": null }, "guild_id": "guildIdHere"
Solution is simple, add a new DiscordObject and deserialize the payload.EventData into it, the class would have to look like this
class BanObject { public User user { get; set; } public string guild_id { get; set; } }
and then finally, user would be supplied like this
User bannedUser = payload.EventData.ToObject<BanObject>().user;