|
9 | 9 | namespace GenericBot |
10 | 10 | { |
11 | 11 |
|
12 | | - [SlashCommand("test", InteractionType.SubCommand, "Ver as informações de tempo da sua cidade")] |
| 12 | + [SlashCommand("testo", InteractionType.SubCommand, "Ver as informações de tempo da sua cidade")] |
13 | 13 | public class TestCommand : ISlashCommand |
14 | 14 | { |
15 | 15 | public async Task RunAsync(InteractionContext context, CancellationToken cancellation = default) |
16 | 16 | { |
17 | | - |
18 | | - var message = new Message() |
19 | | - { |
20 | | - Content = "Teste", |
21 | | - ActionRows = new List<IActionRowBuilder> |
22 | | - { |
23 | | - new ActionRowBuilder() |
24 | | - .AddSelectMenu("test_select", new List<StringSelectOption>() |
25 | | - { |
26 | | - new StringSelectOption() |
27 | | - { |
28 | | - Label = "Opção 1", |
29 | | - Value = "option_1" |
30 | | - }, |
31 | | - |
32 | | - }, context: context, callback: TestCallback3Async), |
33 | | - |
34 | | - |
35 | | - new ActionRowBuilder() |
36 | | - .AddButton("Testar", "test_button", ButtonStyle.Primary, context, TestCallbackAsync) |
37 | | - .AddLinkButton("Testar 2", "https://www.linkedin.com/in/dridev/") |
38 | | - } |
39 | | - }; |
| 17 | + var message = new MessageBuilder() |
| 18 | + .WithContent("teste") |
| 19 | + .WithEmbed(embed => embed |
| 20 | + .SetTitle("Embed de teste") |
| 21 | + .SetDescription("Mensagem gerada com MessageBuilder + EmbedBuilder") |
| 22 | + .SetColor(0x5865F2) |
| 23 | + .AddField("Comando", "/test", inline: true)) |
| 24 | + .WithActionRow(new ActionRowBuilder() |
| 25 | + .AddButton("Testar", "test_button", ButtonStyle.Primary, context, TestCallbackAsync) |
| 26 | + .AddLinkButton("Testar 2", "https://www.linkedin.com/in/dridev/") |
| 27 | + ).Build(); |
40 | 28 |
|
41 | 29 | await context.Response.SendMessageAsync(message, cancellation); |
42 | 30 | } |
43 | 31 |
|
44 | 32 | private async Task TestCallbackAsync(InteractionContext context) |
45 | 33 | { |
46 | | - await context.Response.SendMessageAsync(new Message() |
47 | | - { |
48 | | - Content = "Teste", |
49 | | - }); |
| 34 | + await context.Response.SendMessageAsync(new MessageBuilder() |
| 35 | + .WithContent("Teste") |
| 36 | + .WithEmbed(embed => embed |
| 37 | + .SetTitle("Callback executado") |
| 38 | + .SetDescription("Resposta criada via MessageBuilder") |
| 39 | + .SetColor(0x57F287)) |
| 40 | + .Build()); |
50 | 41 | } |
51 | 42 |
|
52 | 43 | private async Task TestCallback3Async(InteractionContext context) |
|
0 commit comments