geekbot/Geekbot.net/Modules/Info.cs

34 lines
1.1 KiB
C#
Raw Normal View History

2017-05-06 20:35:31 +02:00
using System.Threading.Tasks;
using Discord;
2017-04-25 20:59:38 +02:00
using Discord.Commands;
2017-05-06 20:35:31 +02:00
using Geekbot.net.Lib.IClients;
namespace Geekbot.net.Modules
{
public class Info : ModuleBase
{
2017-04-19 19:54:29 +02:00
private readonly IRedisClient redis;
public Info(IRedisClient redisClient)
{
redis = redisClient;
}
2017-04-25 20:59:38 +02:00
[Command("info", RunMode = RunMode.Async), Summary("Get Information about the bot")]
public async Task BotInfo()
{
var eb = new EmbedBuilder();
2017-04-21 22:51:30 +02:00
2017-04-25 20:59:38 +02:00
eb.WithTitle("Geekbot V3");
2017-04-21 22:51:30 +02:00
2017-04-25 20:59:38 +02:00
var botOwner = Context.Guild.GetUserAsync(ulong.Parse(redis.Client.StringGet("botOwner"))).Result;
2017-04-19 19:54:29 +02:00
2017-04-25 20:59:38 +02:00
eb.AddInlineField("Status", Context.Client.ConnectionState.ToString())
.AddInlineField("Bot Name", Context.Client.CurrentUser.Username)
.AddInlineField("Bot Owner", $"{botOwner.Username}#{botOwner.Discriminator}");
2017-04-21 22:51:30 +02:00
2017-04-25 20:59:38 +02:00
eb.AddInlineField("Servers", Context.Client.GetGuildsAsync().Result.Count);
await ReplyAsync("", false, eb.Build());
2017-04-21 22:51:30 +02:00
}
}
}