mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-14 06:18:42 +00:00
fix bot abuse
This commit is contained in:
parent
a407baa466
commit
d619d6f8e3
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using CompatApiClient.Utils;
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus.Entities;
|
||||
using DSharpPlus.EventArgs;
|
||||
|
||||
namespace CompatBot.EventHandlers
|
||||
@ -40,6 +42,9 @@ namespace CompatBot.EventHandlers
|
||||
tableIdx = content.IndexOf("┻━┻");
|
||||
var faceIdx = content.Substring(0, tableIdx).LastIndexOfAny(OpenParen);
|
||||
var face = content.Substring(faceIdx, tableIdx - faceIdx);
|
||||
if (face.Length > 20)
|
||||
return;
|
||||
|
||||
var reverseFace = face
|
||||
.Replace("(╯", "╯(").Replace("(ノ", "ノ(").Replace("(ノ", "ノ(").Replace("(/¯", @"\_/(")
|
||||
.Replace(")╯", "╯)").Replace(")ノ", "ノ)").Replace(")ノ", "ノ)").Replace(")/¯", @"\_/)")
|
||||
@ -54,7 +59,10 @@ namespace CompatBot.EventHandlers
|
||||
if (reverseFace == face)
|
||||
return;
|
||||
|
||||
await args.Channel.SendMessageAsync("┬─┬ " + reverseFace).ConfigureAwait(false);
|
||||
var faceLength = reverseFace.Length;
|
||||
if (faceLength > 5+4)
|
||||
reverseFace = $"{reverseFace.Substring(0, 2)}ಠ益ಠ{reverseFace.Substring(faceLength - 2, 2)}";
|
||||
await args.Channel.SendMessageAsync("┬─┬ " + reverseFace.Sanitize()).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -160,6 +160,10 @@ namespace CompatBot.Utils
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!emojiName.StartsWith(":"))
|
||||
emojiName = ":" + emojiName;
|
||||
if (!emojiName.EndsWith(":"))
|
||||
emojiName = emojiName + ":";
|
||||
return DiscordEmoji.FromName(client, emojiName);
|
||||
}
|
||||
catch
|
||||
|
Loading…
Reference in New Issue
Block a user