예제 #1
0
        internal static RestApplication Create(BaseDiscordClient discord, Model model)
        {
            RestApplication entity = new RestApplication(discord, model.Id);

            entity.Update(model);
            return(entity);
        }
예제 #2
0
        /// <exception cref="InvalidOperationException">Unable to update this object from a different application token.</exception>
        public async Task UpdateAsync()
        {
            Model response = await Discord.ApiClient.GetMyApplicationAsync().ConfigureAwait(false);

            if (response.Id != Id)
            {
                throw new InvalidOperationException("Unable to update this object from a different application token.");
            }
            Update(response);
        }
예제 #3
0
 internal void Update(Model model)
 {
     Description          = model.Description;
     RPCOrigins           = model.RPCOrigins;
     Name                 = model.Name;
     _iconId              = model.Icon;
     IsBotPublic          = model.IsBotPublic;
     BotRequiresCodeGrant = model.BotRequiresCodeGrant;
     if (model.Flags.IsSpecified)
     {
         Flags = model.Flags.Value; //TODO: Do we still need this?
     }
     if (model.Owner.IsSpecified)
     {
         Owner = RestUser.Create(Discord, model.Owner.Value);
     }
     if (model.Team != null)
     {
         Team = RestTeam.Create(Discord, model.Team);
     }
 }