Added some help text

This commit is contained in:
Deukhoofd 2018-03-31 18:50:06 +02:00
parent 6af6bc9629
commit 1cb3f981d5
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 28 additions and 22 deletions

View File

@ -12,6 +12,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
public override string Name => "General"; public override string Name => "General";
[Command("info", PermissionLevel.Everyone)] [Command("info", PermissionLevel.Everyone)]
[CommandHelp("Gives basic info on the bot", "Gives basic info on the bot")]
public async Task Info(CommandRequest request) public async Task Info(CommandRequest request)
{ {
var embed = new EmbedBuilder var embed = new EmbedBuilder

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.Database.ServerSettings; using DeukBot4.Database.ServerSettings;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure; using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
@ -106,6 +105,13 @@ namespace DeukBot4.MessageHandlers.CommandHandler
[Command("mute", PermissionLevel.Helper)] [Command("mute", PermissionLevel.Helper)]
[CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Timespan)] [CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Timespan)]
[CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Number)] [CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Number)]
[CommandHelp("Silences a user for a set amount of time",
"Allows you to mute a user for a set amount of time.\n." +
"Usage:\n" +
"``mute {User Mention} {amount of minutes to silence}``\n" +
"``mute {User ID} {amount of minutes to silence}``\n" +
"``mute {User Mention} {Timespan (amount + time indicator: i.e. 5s, 10m, 3h, 1d)}``\n" +
"``mute {User ID} {Timespan (amount + time indicator: i.e. 5s, 10m, 3h, 1d)}``\n")]
[BlockUsageInPm] [BlockUsageInPm]
public async Task SilenceUser(CommandRequest request) public async Task SilenceUser(CommandRequest request)
{ {
@ -140,16 +146,16 @@ namespace DeukBot4.MessageHandlers.CommandHandler
await user.AddRoleAsync(silencedRole); await user.AddRoleAsync(silencedRole);
TimeSpan span; TimeSpan span;
if (request.Parameters[1].Type == ParameterMatcher.ParameterType.Number) switch (request.Parameters[1].Type)
{ {
case ParameterMatcher.ParameterType.Number:
var minutes = request.Parameters[1].AsInt(); var minutes = request.Parameters[1].AsInt();
if (!minutes.HasValue) if (!minutes.HasValue)
return; return;
span = TimeSpan.FromMinutes(minutes.Value); span = TimeSpan.FromMinutes(minutes.Value);
} break;
else if (request.Parameters[1].Type == ParameterMatcher.ParameterType.Timespan) case ParameterMatcher.ParameterType.Timespan:
{
var sp = TimespanParser.Parse(request.Parameters[1].AsString()); var sp = TimespanParser.Parse(request.Parameters[1].AsString());
if (sp.HasValue) if (sp.HasValue)
{ {
@ -157,12 +163,11 @@ namespace DeukBot4.MessageHandlers.CommandHandler
} }
else else
{ {
Console.WriteLine("this");
return; return;
} }
}
else break;
{ default:
return; return;
} }