You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

PingCommand.cs 861 B

123456789101112131415161718192021222324252627282930313233
  1. using Discord.Commands;
  2. using Discord.Commands.SlashCommands.Types;
  3. using Discord.SlashCommands;
  4. using Discord.WebSocket;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace SlashCommandsExample.Modules
  10. {
  11. public class PingCommand : SlashCommandModule<SocketInteraction>
  12. {
  13. [SlashCommand("johnny-test", "Ping the bot to see if it is alive!")]
  14. public async Task PingAsync()
  15. {
  16. await Interaction.FollowupAsync(":white_check_mark: **Bot Online**");
  17. }
  18. }
  19. }
  20. /*
  21. The base way of defining a command using the regular command service:
  22. public class PingModule : ModuleBase<SocketCommandContext>
  23. {
  24. [Command("ping")]
  25. [Summary("Pong! Check if the bot is alive.")]
  26. public async Task PingAsync()
  27. {
  28. await ReplyAsync(":white_check_mark: **Bot Online**");
  29. }
  30. }
  31. */