geekbot/Geekbot.net/Commands/Utils/Help.cs

39 lines
1.1 KiB
C#
Raw Normal View History

using System;
2017-09-15 22:56:03 +02:00
using System.Text;
using System.Threading.Tasks;
2018-03-02 23:35:14 +01:00
using Discord;
2017-04-17 16:58:48 +02:00
using Discord.Commands;
using Geekbot.net.Lib.ErrorHandling;
2017-04-17 16:58:48 +02:00
namespace Geekbot.net.Commands.Utils
2017-04-17 16:58:48 +02:00
{
public class Help : ModuleBase
{
private readonly IErrorHandler _errorHandler;
2017-09-15 22:56:03 +02:00
2017-11-06 23:55:28 +01:00
public Help(IErrorHandler errorHandler)
2017-09-15 22:56:03 +02:00
{
_errorHandler = errorHandler;
2017-09-15 22:56:03 +02:00
}
[Command("help", RunMode = RunMode.Async)]
[Summary("List all Commands")]
2017-04-17 16:58:48 +02:00
public async Task GetHelp()
{
try
2017-04-17 16:58:48 +02:00
{
var sb = new StringBuilder();
sb.AppendLine("For a list of all commands, please visit the following page");
sb.AppendLine("https://geekbot.pizzaandcoffee.rocks/commands");
var dm = await Context.User.GetOrCreateDMChannelAsync();
await dm.SendMessageAsync(sb.ToString());
2018-04-28 02:46:30 +02:00
await Context.Message.AddReactionAsync(new Emoji("✅"));
}
catch (Exception e)
{
_errorHandler.HandleCommandException(e, Context);
2017-04-17 16:58:48 +02:00
}
2017-09-15 22:56:03 +02:00
}
2017-04-17 16:58:48 +02:00
}
}