Something went wrong. Try again.
Simple template for Discord bots, using Discord.Net
Something went wrong. Try again.
123456789101112131415161718192021222324252627// ReSharper disable UnusedType.Global, UnusedMember.Global
using Discord;using Discord.Interactions;
namespace DiscordBot.Modules;
public class GeneralModule : InteractionModuleBase<SocketInteractionContext> { [SlashCommand("ping", "Pings the bot and returns its latency.")] public async Task PingAsync() => await RespondAsync("Pong!");
[SlashCommand("echo", "Echoes the provided message.")] public async Task EchoAsync([Summary("message", "The message to echo back.")] string message) => await RespondAsync(message);
[DefaultMemberPermissions(GuildPermission.Administrator)] [SlashCommand("adminonly", "An admin-only command.")] public async Task AdminsOnlyCommandAsync() => await RespondAsync("This is an admin-only command.");
[CommandContextType(InteractionContextType.BotDm)] [SlashCommand("dm", "A command that can only be used in DMs with the bot.")] public async Task DmOnlyCommandAsync() => await RespondAsync("This command was used in a DM with the bot.");}