DeukBot4/DeukBot4/MessageHandlers/CommandHandler/Commands/GeneralCommands.cs

73 lines
3.1 KiB
C#
Raw Normal View History

2018-03-29 17:39:23 +00:00
using System;
using System.Threading.Tasks;
2018-03-28 23:34:48 +00:00
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
using DeukBot4.MessageHandlers.Permissions;
2018-03-30 14:33:42 +00:00
using DeukBot4.Utilities;
2018-03-29 17:39:23 +00:00
using Discord;
2018-03-28 23:34:48 +00:00
namespace DeukBot4.MessageHandlers.CommandHandler
{
public class GeneralCommands : CommandContainerBase
{
public override string Name => "General";
2018-03-29 17:39:23 +00:00
[Command("info", PermissionLevel.Everyone)]
2018-03-31 16:50:06 +00:00
[CommandHelp("Gives basic info on the bot", "Gives basic info on the bot")]
2018-03-29 17:39:23 +00:00
public async Task Info(CommandRequest request)
{
var embed = new EmbedBuilder
{
Author = new EmbedAuthorBuilder()
{
Name = "DeukBot",
Url = "https://gitlab.com/Deukhoofd/DeukBot4/tree/master/DeukBot4/MessageHandlers/CommandHandler"
},
Color = Color.Gold,
Title = "Deukbot Info",
Description = "A bot designed by Deukhoofd for use on the Epsilon server",
Timestamp = DateTime.UtcNow
};
embed.AddField("Software", "Deukbot 4.0", true);
embed.AddField("Creator", "Deukhoofd#7361", true);
await request.SendMessageAsync("", embed: embed.Build());
2018-03-29 17:39:23 +00:00
}
2018-03-28 23:34:48 +00:00
[Command("ping", PermissionLevel.Everyone)]
[CommandHelp("Simple Ping Pong Response", "Generates a simple Pong response when triggered")]
public async Task Ping(CommandRequest request)
{
await request.SendMessageAsync("Pong");
2018-03-28 23:34:48 +00:00
}
[Command("help", PermissionLevel.Everyone)]
[CommandParameters(new []{ParameterMatcher.ParameterType.Word})]
[CommandHelp("Displays a list of commands for the bot",
"Allows you to see all commands you can use for your permission level, along with a description.\n" +
"usage:\n``help`` for a list of all commands useable for you.\n" +
"``help`` [command name] for more detailed info on a specific command. " +
"Note that you need to be able to use the command to get this info.")]
2018-03-28 23:34:48 +00:00
public async Task Help(CommandRequest request)
{
if (request.Parameters.Length == 0)
{
await request.SendMessageAsync(HelpCommandGenerator.GenerateFullHelp(request.RequestPermissions));
2018-03-28 23:34:48 +00:00
}
else
{
await request.SendMessageAsync("",
embed: HelpCommandGenerator.GenerateSpecificHelp(request.Parameters[0].AsString(),
2018-03-30 12:51:38 +00:00
request.RequestPermissions));
2018-03-28 23:34:48 +00:00
}
}
2018-03-30 14:33:42 +00:00
[Command("whatdoyouthinkdeukbot", PermissionLevel.Everyone)]
[Command("whatdoyouthink", PermissionLevel.Everyone)]
2018-04-03 12:40:24 +00:00
[CommandHelp("Gives the bots opinion about something", "Gives the bots opinion about something\nusage:\n``whatdoyouthink {about something}``")]
2018-03-30 14:33:42 +00:00
[CommandParameters(ParameterMatcher.ParameterType.Remainder)]
public async Task BotOpinion(CommandRequest request)
{
await request.SendMessageAsync(BotOpinions.GetOpinion(request));
2018-03-30 14:33:42 +00:00
}
2018-03-28 23:34:48 +00:00
}
}