internal static RestApplication Create(BaseDiscordClient discord, Model model) { RestApplication entity = new RestApplication(discord, model.Id); entity.Update(model); return(entity); }
/// <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); }
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); } }