internal new static SocketModal Create(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user) { var entity = new SocketModal(client, model, channel, user); entity.Update(model); return(entity); }
internal new static SocketInteraction Create(DiscordSocketClient client, Model model, ISocketMessageChannel channel) { var entity = new SocketCommandBase(client, model, channel); entity.Update(model); return(entity); }
internal override void Update(Model model) { base.Update(model); if (model.Message.IsSpecified) { if (Message == null) { SocketUser author = null; if (Channel is SocketGuildChannel channel) { if (model.Message.Value.WebhookId.IsSpecified) { author = SocketWebhookUser.Create(channel.Guild, Discord.State, model.Message.Value.Author.Value, model.Message.Value.WebhookId.Value); } else if (model.Message.Value.Author.IsSpecified) { author = channel.Guild.GetUser(model.Message.Value.Author.Value.Id); } } else if (model.Message.Value.Author.IsSpecified) { author = (Channel as SocketChannel).GetUser(model.Message.Value.Author.Value.Id); } Message = SocketUserMessage.Create(Discord, Discord.State, author, Channel, model.Message.Value); } else { Message.Update(Discord.State, model.Message.Value); } } }
internal RestModal(DiscordRestClient client, ModelBase model) : base(client, model.Id) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data = new RestModalData(dataModel); }
internal SocketMessageComponent(DiscordSocketClient client, Model model, ISocketMessageChannel channel) : base(client, model.Id, channel) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data = new SocketMessageComponentData(dataModel); }
internal RestMessageComponent(BaseDiscordClient client, Model model) : base(client, model.Id) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data = new RestMessageComponentData(dataModel); }
internal SocketModal(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user) : base(client, model.Id, channel, user) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data = new SocketModalData(dataModel); }
internal override async Task UpdateAsync(DiscordRestClient client, Model model) { await base.UpdateAsync(client, model).ConfigureAwait(false); var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data = await RestMessageCommandData.CreateAsync(client, dataModel, Guild, Channel).ConfigureAwait(false); }
internal override void Update(Model model) { var data = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; Data.Update(data); base.Update(model); }
internal override async Task UpdateAsync(DiscordRestClient discord, Model model, bool doApiCall) { await base.UpdateAsync(discord, model, doApiCall).ConfigureAwait(false); if (model.Message.IsSpecified && model.ChannelId.IsSpecified) { if (Message == null) { Message = RestUserMessage.Create(Discord, Channel, User, model.Message.Value); } } }
internal RestAutocompleteInteraction(DiscordRestClient client, Model model) : base(client, model.Id) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; if (dataModel != null) { Data = new RestAutocompleteInteractionData(dataModel); } }
internal SocketAutocompleteInteraction(DiscordSocketClient client, Model model, ISocketMessageChannel channel) : base(client, model.Id, channel) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; if (dataModel != null) { Data = new SocketAutocompleteInteractionData(dataModel); } }
internal SocketMessageCommand(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) : base(client, model, channel, user) { var dataModel = model.Data.IsSpecified ? (DataModel)model.Data.Value : null; ulong? guildId = null; if (Channel is SocketGuildChannel guildChannel) guildId = guildChannel.Guild.Id; Data = SocketMessageCommandData.Create(client, dataModel, model.Id, guildId); }
internal static SocketInteraction Create(DiscordSocketClient client, Model model, ISocketMessageChannel channel) { 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 => SocketSlashCommand.Create(client, model, channel), ApplicationCommandType.Message => SocketMessageCommand.Create(client, model, channel), ApplicationCommandType.User => SocketUserCommand.Create(client, model, channel), _ => null });
internal RestMessageCommand(DiscordRestClient client, Model model) : base(client, model) { }
internal new static async Task <RestAutocompleteInteraction> CreateAsync(DiscordRestClient client, Model model) { var entity = new RestAutocompleteInteraction(client, model); await entity.UpdateAsync(client, model).ConfigureAwait(false); return(entity); }
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 RestUserCommand(DiscordRestClient client, Model model) : base(client, model) { }
internal RestCommandBase(DiscordRestClient client, Model model) : base(client, model.Id) { }
internal new static SocketMessageComponent Create(DiscordSocketClient client, Model model, ISocketMessageChannel channel) { var entity = new SocketMessageComponent(client, model, channel); entity.Update(model); return(entity); }
internal override async Task UpdateAsync(DiscordRestClient client, Model model) { await base.UpdateAsync(client, model).ConfigureAwait(false); }
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 });
internal new static async Task <RestMessageCommand> CreateAsync(DiscordRestClient client, Model model) { var entity = new RestMessageCommand(client, model); await entity.UpdateAsync(client, model).ConfigureAwait(false); return(entity); }
internal new static SocketInteraction Create(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) { var entity = new SocketMessageCommand(client, model, channel, user); entity.Update(model); return entity; }
internal new static SocketAutocompleteInteraction Create(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) { var entity = new SocketAutocompleteInteraction(client, model, channel, user); entity.Update(model); return(entity); }
internal new static async Task <RestCommandBase> CreateAsync(DiscordRestClient client, Model model, bool doApiCall) { var entity = new RestCommandBase(client, model); await entity.UpdateAsync(client, model, doApiCall).ConfigureAwait(false); return(entity); }
internal new static async Task <RestModal> CreateAsync(DiscordRestClient client, ModelBase model, bool doApiCall) { var entity = new RestModal(client, model); await entity.UpdateAsync(client, model, doApiCall); return(entity); }