Ejemplo n.º 1
0
        private static async Task AutoModAsync(SocketCommandContext Context, bool isCommand)
        {
            Task <bool>[] isZalgo =
            {
                Zalgo.IsZalgoAsync(Context),
                configDatabase.AntiZalgo.GetAntiZalgoAsync(Context.Guild)
            };
            Task <bool>[] isSpam =
            {
                Spam.IsSpamAsync(Context),
                configDatabase.AntiSpam.GetAntiSpamAsync(Context.Guild)
            };
            Task <bool>[] isSingleSpam =
            {
                Spam.IsSingleSpamAsync(Context),
                configDatabase.AntiSingleSpam.GetAntiSingleSpamAsync(Context.Guild)
            };
            Task <bool>[] isMassMention =
            {
                MassMention.IsMassMentionAsync(Context),
                configDatabase.AntiMassMention.GetAntiMassMentionAsync(Context.Guild)
            };
            Task <bool>[] isCaps =
            {
                CAPS.ISCAPSASYNC(Context),
                configDatabase.AntiCaps.GetAntiCapsAsync(Context.Guild)
            };
            Task <bool>[] isInvite =
            {
                Invite.HasInviteAsync(Context),
                configDatabase.AntiInvite.GetAntiInviteAsync(Context.Guild)
            };
            Task <bool>[] isLink =
            {
                Link.IsLinkAsync(Context),
                configDatabase.AntiLink.GetAntiLinkAsync(Context.Guild)
            };

            if (await configDatabase.AutoSurveillance.GetAutoSurveillanceAsync(Context.Guild))
            {
                if (await AutoSurveillanceAsync(Context))
                {
                    return;
                }
            }

            if ((await Task.WhenAll(isZalgo)).All(x => x))
            {
                await new Zalgo(Context).WarnAsync();
            }
            else if (((await Task.WhenAll(isSpam)).All(x => x) || (await Task.WhenAll(isSingleSpam)).All(x => x)) && !isCommand)
            {
                await new Spam(Context).WarnAsync();
            }
            else if ((await Task.WhenAll(isMassMention)).All(x => x))
            {
                await new MassMention(Context).WarnAsync();
            }
            else if ((await Task.WhenAll(isCaps)).All(x => x))
            {
                await new CAPS(Context).WARNASYNC();
            }
            else if ((await Task.WhenAll(isInvite)).All(x => x))
            {
                await new Invite(Context).RemoveAsync();
            }
            else if ((await Task.WhenAll(isLink)).All(x => x))
            {
                await new Link(Context).RemoveAsync();
            }
        }