public async Task HelloWorldSlashCommandAsync(InteractionContext ctx)
        {
            var response = new InteractionResponseBuilder()
                           .WithType(InteractionResponseType.ChannelMessageWithSource)
                           .WithData(new InteractionApplicationCommandCallbackDataBuilder()
                                     .WithEmbed(new DiscordEmbedBuilder()
                                                .WithTitle("Hello World!")
                                                .WithDescription($"And hello to you too, {ctx.Interaction.User.Username}"))
                                     .WithContent("How's Life?"));

            await ctx.ReplyAsync(response.Build());
        }
        public async Task ArgumentSubcommandCommandAsync(InteractionContext ctx, TestChoices choice, int age, string name, bool female,
                                                         DiscordUser user, DiscordChannel channel, DiscordRole role)
        {
            var response = new InteractionResponseBuilder()
                           .WithType(InteractionResponseType.ChannelMessage)
                           .WithData(new InteractionApplicationCommandCallbackDataBuilder()
                                     .WithEmbed(new DiscordEmbedBuilder()
                                                .WithTitle("Testing Arguments!")
                                                .WithDescription($"Choice: {choice}\n" +
                                                                 $"Age: {age}\n" +
                                                                 $"Name: {name}\n" +
                                                                 $"Female? {female}\n" +
                                                                 $"User: {user.Username}\n" +
                                                                 $"Channel: {channel.Name}\n" +
                                                                 $"Role: {role.Name}"))
                                     .WithContent("How's Life?"));

            await ctx.ReplyAsync(response.Build());
        }
Esempio n. 3
0
 public async Task CommandAsync(InteractionContext ctx)
 {
     await ctx.ReplyAsync("This is a subcommand");
 }
 public async Task SubtractCommandAsync(InteractionContext ctx, int num1, int num3)
 => await ctx.ReplyAsync($"{num1 - num3}");
 public async Task MathCommandAsync(InteractionContext ctx, int num1, int num2)
 => await ctx.ReplyAsync($"{num1 + num2}");
 public async Task SlashCommandTestingTwoAsync(InteractionContext ctx, string toSay)
 => await ctx.ReplyAsync(toSay);
 public async Task SlashCommandTestingAsync(InteractionContext ctx)
 => await ctx.ReplyAsync($"Pong: {Program.Discord.Ping}");