diff --git a/ChaosBot/Discord/Modules/User/Info.cs b/ChaosBot/Discord/Modules/User/Info.cs new file mode 100644 index 0000000..e2c6e41 --- /dev/null +++ b/ChaosBot/Discord/Modules/User/Info.cs @@ -0,0 +1,49 @@ +using System; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using ChaosBot.Discord.PreConditions; +using ChaosBot.Repositories; +using Discord; +using Discord.Commands; +using Microsoft.Extensions.Configuration; +using NLog; + +namespace ChaosBot.Discord.Modules.User +{ + public class Info : ModuleBase + { + private static readonly ILogger Logger = Program.Logger; + + [Command("info")] + [Alias("version")] + [CheckCommandPerm("User")] + public async Task ShowInfo() + { + try + { + var sb = new StringBuilder(); + var embed = new EmbedBuilder(); + + embed.WithColor(new Color(255, 255, 0)); + embed.Title = $"Information {Program.AppSettingsHandler.GetValue("Bot:Name")} v{Program.AppSettingsHandler.GetValue("Bot:Version")}"; + sb.AppendLine($"Prefix: {ConfigurationRepository.GetValue("Discord:Prefix", Context.Guild.Id)}"); + + /* + * Add the string to the Embed + */ + embed.Description = sb.ToString(); + + /* + * Reply with the Embed created above + */ + await ReplyAsync(null, false, embed.Build()); + } + catch(Exception ex) + { + Logger.Error( + $"{MethodBase.GetCurrentMethod().ReflectedType.FullName}: Exception [{ex}] thrown, <[{ex.Message}]>."); + } + } + } +} \ No newline at end of file