Make mute/silence default to 5 minutes

This commit is contained in:
Deukhoofd 2018-04-30 19:38:43 +02:00
parent b106785ebc
commit c3b23d150f
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 28 additions and 24 deletions

View File

@ -105,6 +105,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
[Command("mute", PermissionLevel.Helper)]
[CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Timespan)]
[CommandParameters(ParameterMatcher.ParameterType.User, ParameterMatcher.ParameterType.Number)]
[CommandParameters(ParameterMatcher.ParameterType.User)]
[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" +
@ -146,6 +147,12 @@ namespace DeukBot4.MessageHandlers.CommandHandler
await user.AddRoleAsync(silencedRole);
TimeSpan span;
if (request.Parameters.Length == 1)
{
span = TimeSpan.FromMinutes(5);
}
else
{
switch (request.Parameters[1].Type)
{
case ParameterMatcher.ParameterType.Number:
@ -170,6 +177,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
default:
return;
}
}
await Task.Delay(span);
await user.RemoveRoleAsync(silencedRole);

View File

@ -18,16 +18,12 @@ namespace DeukBot4.Utilities
{
case 's':
return TimeSpan.FromSeconds(number);
break;
case 'm':
return TimeSpan.FromMinutes(number);
break;
case 'h':
return TimeSpan.FromHours(number);
break;
case 'd':
return TimeSpan.FromDays(number);
break;
default:
return null;
}