internal static new async Task <RestPingInteraction> CreateAsync(DiscordRestClient client, Model model) { var entity = new RestPingInteraction(client, model.Id); await entity.UpdateAsync(client, model); return(entity); }
internal static async Task <RestInteraction> CreateAsync(DiscordRestClient client, Model model) { if (model.Type == InteractionType.Ping) { return(await RestPingInteraction.CreateAsync(client, model)); } if (model.Type == InteractionType.ApplicationCommand) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; if (dataModel == null) { return(null); } return(dataModel.Type switch { ApplicationCommandType.Slash => await RestSlashCommand.CreateAsync(client, model).ConfigureAwait(false), ApplicationCommandType.Message => await RestMessageCommand.CreateAsync(client, model).ConfigureAwait(false), ApplicationCommandType.User => await RestUserCommand.CreateAsync(client, model).ConfigureAwait(false), _ => null });