Make mute/silence default to 5 minutes
This commit is contained in:
parent
b106785ebc
commit
c3b23d150f
|
@ -105,6 +105,7 @@ 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)]
|
||||||
|
[CommandParameters(ParameterMatcher.ParameterType.User)]
|
||||||
[CommandHelp("Silences a user for a set amount of time",
|
[CommandHelp("Silences a user for a set amount of time",
|
||||||
"Allows you to mute a user for a set amount of time.\n." +
|
"Allows you to mute a user for a set amount of time.\n." +
|
||||||
"Usage:\n" +
|
"Usage:\n" +
|
||||||
|
@ -146,6 +147,12 @@ namespace DeukBot4.MessageHandlers.CommandHandler
|
||||||
await user.AddRoleAsync(silencedRole);
|
await user.AddRoleAsync(silencedRole);
|
||||||
|
|
||||||
TimeSpan span;
|
TimeSpan span;
|
||||||
|
if (request.Parameters.Length == 1)
|
||||||
|
{
|
||||||
|
span = TimeSpan.FromMinutes(5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (request.Parameters[1].Type)
|
switch (request.Parameters[1].Type)
|
||||||
{
|
{
|
||||||
case ParameterMatcher.ParameterType.Number:
|
case ParameterMatcher.ParameterType.Number:
|
||||||
|
@ -170,6 +177,7 @@ namespace DeukBot4.MessageHandlers.CommandHandler
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Delay(span);
|
await Task.Delay(span);
|
||||||
await user.RemoveRoleAsync(silencedRole);
|
await user.RemoveRoleAsync(silencedRole);
|
||||||
|
|
|
@ -18,16 +18,12 @@ namespace DeukBot4.Utilities
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
return TimeSpan.FromSeconds(number);
|
return TimeSpan.FromSeconds(number);
|
||||||
break;
|
|
||||||
case 'm':
|
case 'm':
|
||||||
return TimeSpan.FromMinutes(number);
|
return TimeSpan.FromMinutes(number);
|
||||||
break;
|
|
||||||
case 'h':
|
case 'h':
|
||||||
return TimeSpan.FromHours(number);
|
return TimeSpan.FromHours(number);
|
||||||
break;
|
|
||||||
case 'd':
|
case 'd':
|
||||||
return TimeSpan.FromDays(number);
|
return TimeSpan.FromDays(number);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue