using Discord; using Discord.Interactions; namespace TentacleBot.Commands; [Group("general", "General commands")] public class GeneralCommands : InteractionModuleBase { /// /// Example ping command that responds with pong /// [SlashCommand("ping", "Responds with pong and latency")] public async Task HandlePingAsync() { await DeferAsync(); var latency = Context.Client.Latency; var embed = new EmbedBuilder() .WithTitle("Pong!") .WithDescription($"Latency: {latency}ms") .WithColor(Color.Green) .WithTimestamp(DateTimeOffset.UtcNow) .Build(); await FollowupAsync(embed: embed); } /// /// Example hello command with a user parameter /// [SlashCommand("hello", "Greet a user")] public async Task HandleHelloAsync( [Summary("user", "The user to greet")] IUser? user = null) { await DeferAsync(); var targetUser = user ?? Context.User; var embed = new EmbedBuilder() .WithTitle($"Hello, {targetUser.Username}!") .WithDescription($"Nice to meet you! ?") .WithThumbnailUrl(targetUser.GetAvatarUrl() ?? targetUser.GetDefaultAvatarUrl()) .WithColor(Color.Blue) .WithTimestamp(DateTimeOffset.UtcNow) .Build(); await FollowupAsync(embed: embed); } /// /// Example command that shows bot information /// [SlashCommand("botinfo", "Display bot information")] public async Task HandleBotInfoAsync() { await DeferAsync(); var bot = Context.Client.CurrentUser; var embed = new EmbedBuilder() .WithTitle("Bot Information") .AddField("Name", bot?.Username, true) .AddField("ID", bot?.Id, true) .AddField("Created", bot?.CreatedAt.ToString("g"), true) .AddField("Guilds", Context.Client.Guilds.Count, true) .WithColor(Color.Purple) .WithThumbnailUrl(bot?.GetAvatarUrl()) .WithTimestamp(DateTimeOffset.UtcNow) .Build(); await FollowupAsync(embed: embed); } }