Beispiel #1
0
        internal static SocketPresence Create(Model model)
        {
            IImmutableSet <ClientType> clients    = ConvertClientTypesDict(model.ClientStatus.GetValueOrDefault());
            IImmutableList <IActivity> activities = ConvertActivitiesList(model.Activities);

            return(new SocketPresence(model.Status, model.Game?.ToEntity(), clients, activities));
        }
        internal static SocketGuildUser Create(SocketGuild guild, ClientState state, PresenceModel model)
        {
            SocketGuildUser entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model.User));

            entity.Update(state, model, false);
            return(entity);
        }
 internal void Update(ClientState state, PresenceModel model, bool updatePresence)
 {
     if (updatePresence)
     {
         Presence = SocketPresence.Create(model);
         GlobalUser.Update(state, model);
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     if (model.Roles.IsSpecified)
     {
         UpdateRoles(model.Roles.Value);
     }
     if (model.PremiumSince.IsSpecified)
     {
         _premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
     }
 }
Beispiel #4
0
 internal void Update(ClientState state, PresenceModel model)
 {
     Presence  = SocketPresence.Create(model);
     DMChannel = state.DMChannels.FirstOrDefault(x => x.Recipient.Id == Id);
 }