If timespan of muting is lower or equal to 0 default to the minimum

This commit is contained in:
Deukhoofd 2018-05-06 18:43:21 +02:00
parent c3b23d150f
commit a98f34527f
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 10 additions and 9 deletions

View File

@ -179,6 +179,8 @@ namespace DeukBot4.MessageHandlers.CommandHandler
} }
} }
if (span.Seconds <= 0)
span = TimeSpan.FromMinutes(5);
await Task.Delay(span); await Task.Delay(span);
await user.RemoveRoleAsync(silencedRole); await user.RemoveRoleAsync(silencedRole);
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using DeukBot4.Utilities; using DeukBot4.Utilities;
using Discord.WebSocket; using Discord.WebSocket;
@ -38,16 +39,14 @@ namespace DeukBot4.MessageHandlers
private static async Task DeltaHandler(SocketMessage message) private static async Task DeltaHandler(SocketMessage message)
{ {
var lower = message.Content.ToLowerInvariant().RemoveSpecialCharacters().Split(' '); var lowerCasedContent = message.Content.RemoveSpecialCharacters();
foreach (var s in lower) if (lowerCasedContent.Contains("origin"))
{ return;
var diff = Lehvenstein.LevenshteinDistance(s, "delta");
if (diff <= 1)
{
await message.Channel.SendMessageAsync("uhh excuse me it's called Origin and it's an art");
break;
}
var lowerSplit = lowerCasedContent.Split(' ');
if (lowerSplit.Select(s => Lehvenstein.LevenshteinDistance(s, "delta")).Any(diff => diff <= 1))
{
await message.Channel.SendMessageAsync("uhh excuse me it's called Origin and it's an art");
} }
} }