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";
[Command("info", PermissionLevel.Everyone)]
[CommandHelp("Gives basic info on the bot", "Gives basic info on the bot")]
public async Task Info(CommandRequest request)
{
var embed = new EmbedBuilder

View File

@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using DeukBot4.Database.ServerSettings;
using DeukBot4.MessageHandlers.CommandHandler.RequestStructure;
@ -106,6 +105,13 @@ namespace DeukBot4.MessageHandlers.CommandHandler
[Command("mute", PermissionLevel.Helper)]
[CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Timespan)]
[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]
public async Task SilenceUser(CommandRequest request)
{
@ -140,30 +146,29 @@ namespace DeukBot4.MessageHandlers.CommandHandler
await user.AddRoleAsync(silencedRole);
TimeSpan span;
if (request.Parameters[1].Type == ParameterMatcher.ParameterType.Number)
switch (request.Parameters[1].Type)
{
var minutes = request.Parameters[1].AsInt();
if (!minutes.HasValue)
return;
case ParameterMatcher.ParameterType.Number:
var minutes = request.Parameters[1].AsInt();
if (!minutes.HasValue)
return;
span = TimeSpan.FromMinutes(minutes.Value);
}
else if (request.Parameters[1].Type == ParameterMatcher.ParameterType.Timespan)
{
var sp = TimespanParser.Parse(request.Parameters[1].AsString());
if (sp.HasValue)
{
span = sp.Value;
}
else
{
Console.WriteLine("this");
span = TimeSpan.FromMinutes(minutes.Value);
break;
case ParameterMatcher.ParameterType.Timespan:
var sp = TimespanParser.Parse(request.Parameters[1].AsString());
if (sp.HasValue)
{
span = sp.Value;
}
else
{
return;
}
break;
default:
return;
}
}
else
{
return;
}
await Task.Delay(span);