If timespan of muting is lower or equal to 0 default to the minimum
This commit is contained in:
parent
c3b23d150f
commit
a98f34527f
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue