using Fluxer.Net.Commands; using Fluxer.Net.Commands.Attributes; using Fluxer.Net.Data.Models; namespace PluralFlux; /// /// Example command module demonstrating basic commands. /// public class BasicCommands : ModuleBase { /// /// Simple ping command that responds with "pong". /// [Command("ping")] [Summary("Check if the bot is responsive")] public async Task PingCommand() { await ReplyAsync("pong ;P"); } /// /// Hello command that mentions the user. /// [Command("hello")] [Alias("hi", "hey")] [Summary("Get a friendly greeting")] public async Task HelloCommand() { await ReplyAsync($"Hello, <@{Context.User.Id}>! 👋"); } /// /// Info command that shows bot information and available commands. /// [Command("info")] [Summary("Show bot information and available commands")] public async Task InfoCommand() { await ReplyAsync( $"**Fluxer.Net Example Bot**\n" + $"Version: 0.4.0\n" + $"Framework: .NET 7.0\n" + $"Library: Fluxer.Net\n\n" + $"Available Commands:\n" + $"• `/ping` - Check if bot is responsive\n" + $"• `/hello` - Get a friendly greeting\n" + $"• `/info` - Show this information\n" + $"• `/embed` - Show an example rich embed\n" + $"• `/echo ` - Echo back your message\n" + $"• `/add ` - Add two numbers" ); } /// /// Embed command that demonstrates rich embeds using EmbedBuilder. /// [Command("embed")] [Summary("Show an example rich embed")] public async Task EmbedCommand() { var embed = new Fluxer.Net.EmbedBuilder.EmbedBuilder() .WithTitle("Example Rich Embed") .WithDescription("This is a demonstration of Fluxer.Net's EmbedBuilder system, " + "based on Discord.Net's implementation. Embeds support rich formatting " + "with titles, descriptions, fields, images, and more!") .WithColor(0x5865F2) // Blurple color .WithAuthor( name: Context.User.Username, iconUrl: Context.User.Avatar != null ? $"https://cdn.fluxer.dev/avatars/{Context.User.Id}/{Context.User.Avatar}.png" : null ) .WithThumbnailUrl("https://avatars.githubusercontent.com/u/20194446") .AddField("Field 1", "This is an inline field", inline: true) .AddField("Field 2", "This is also inline", inline: true) .AddField("Field 3", "This is another inline field", inline: true) .AddField("Full Width Field", "This field takes up the full width because inline is false", inline: false) .AddField("Bot Stats", $"Guilds: 1\nChannels: 5\nUptime: {DateTime.UtcNow:HH:mm:ss}", inline: true) .WithFooter("Fluxer.Net v0.4.0", "https://avatars.githubusercontent.com/u/20194446") .WithCurrentTimestamp() .Build(); await Context.Client.SendMessage(Context.ChannelId, new() { Content = "Here's an example of a rich embed:", Embeds = new List { embed } }); } /// /// Echo command that repeats the user's message. /// [Command("echo")] [Summary("Echo back your message")] public async Task EchoCommand([Remainder] string message) { await ReplyAsync(message); } /// /// Add command that adds two numbers together. /// [Command("add")] [Summary("Add two numbers together")] public async Task AddCommand(int a, int b) { await ReplyAsync($"{a} + {b} = {a + b}"); } /// /// Example command with optional parameter. /// [Command("greet")] [Summary("Greet someone (or yourself)")] public async Task GreetCommand(string name = "stranger") { await ReplyAsync($"Hello, {name}!"); } }