50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System;
|
|
using Discord;
|
|
using System.Text;
|
|
using Discord.Commands;
|
|
using System.Threading.Tasks;
|
|
using ChaosBot.Repositories;
|
|
using Microsoft.Extensions.Configuration;
|
|
using NLog;
|
|
|
|
namespace ChaosBot.Discord.Modules
|
|
{
|
|
public class InfoCommands : ModuleBase
|
|
{
|
|
private static readonly ILogger _logger = Program.Logger;
|
|
|
|
|
|
[Command("info")]
|
|
[Alias("version")]
|
|
public async Task InfoCommand()
|
|
{
|
|
try
|
|
{
|
|
var sb = new StringBuilder();
|
|
var embed = new EmbedBuilder();
|
|
|
|
embed.WithColor(new Color(255, 255,0));
|
|
embed.Title = $"General Information";
|
|
// TODO: pull bot nickname
|
|
sb.AppendLine($"{Context.User.Mention} has requested information from {Program.AppSettingsHandler.GetValue<string>("Bot:Name")}.");
|
|
sb.AppendLine();
|
|
sb.AppendLine($"Bot Version: {Program.AppSettingsHandler.GetValue<string>("Bot:Version")}");
|
|
sb.AppendLine($"Bot Prefix: {ConfigurationRepository.GetValue<string>("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($"InfoCommands.InfoCommand: Exception [{ex}] thrown, <[{ex.Message}]>.");
|
|
}
|
|
}
|
|
}
|
|
} |