Search in sources :

Example 6 with MemberJSON

use of io.discloader.discloader.network.json.MemberJSON in project DiscLoader by R3alCl0ud.

the class GuildSync method handle.

@Override
public void handle(SocketPacket packet) {
    String d = gson.toJson(packet.d);
    GuildSyncJSON data = gson.fromJson(d, GuildSyncJSON.class);
    IGuild guild = EntityRegistry.getGuildByID(data.id);
    for (PresenceJSON pe : data.presences) {
        guild.setPresence(pe);
    }
    for (MemberJSON me : data.members) {
        guild.addMember(me);
    }
}
Also used : IGuild(io.discloader.discloader.entity.guild.IGuild) PresenceJSON(io.discloader.discloader.network.json.PresenceJSON) GuildSyncJSON(io.discloader.discloader.network.json.GuildSyncJSON) MemberJSON(io.discloader.discloader.network.json.MemberJSON)

Aggregations

MemberJSON (io.discloader.discloader.network.json.MemberJSON)6 IGuild (io.discloader.discloader.entity.guild.IGuild)4 IGuildMember (io.discloader.discloader.entity.guild.IGuildMember)4 PresenceJSON (io.discloader.discloader.network.json.PresenceJSON)2 GuildMemberNicknameUpdateEvent (io.discloader.discloader.common.event.guild.member.GuildMemberNicknameUpdateEvent)1 GuildMemberRoleAddEvent (io.discloader.discloader.common.event.guild.member.GuildMemberRoleAddEvent)1 GuildMemberRoleRemoveEvent (io.discloader.discloader.common.event.guild.member.GuildMemberRoleRemoveEvent)1 GuildMemberUpdateEvent (io.discloader.discloader.common.event.guild.member.GuildMemberUpdateEvent)1 GuildMembersChunkEvent (io.discloader.discloader.common.event.guild.member.GuildMembersChunkEvent)1 AccountTypeException (io.discloader.discloader.common.exceptions.AccountTypeException)1 GuildSyncException (io.discloader.discloader.common.exceptions.GuildSyncException)1 MissmatchException (io.discloader.discloader.common.exceptions.MissmatchException)1 PermissionsException (io.discloader.discloader.common.exceptions.PermissionsException)1 UnauthorizedException (io.discloader.discloader.common.exceptions.UnauthorizedException)1 IGuildChannel (io.discloader.discloader.entity.channel.IGuildChannel)1 IGuildTextChannel (io.discloader.discloader.entity.channel.IGuildTextChannel)1 IGuildVoiceChannel (io.discloader.discloader.entity.channel.IGuildVoiceChannel)1 IGuildEmoji (io.discloader.discloader.entity.guild.IGuildEmoji)1 IRole (io.discloader.discloader.entity.guild.IRole)1 VoiceRegion (io.discloader.discloader.entity.guild.VoiceRegion)1