Ejemplo n.º 1
0
        private async Task CheckRules(SocketMessage message)
        {
            if (message.Author.Id == 235849760253280257 && !message.Channel.Id.EqualsMulti(ChannelIds.Animal, ChannelIds.Chill, ChannelIds.Vent, ChannelIds.Advice))
            {
                await message.DeleteAsync();

                return;
            }

            if (message.Author.IsBot)
            {
                return;
            }

            if (message.Channel.Id == (ulong)ChannelIds.Mod || message.Channel.Id == (ulong)ChannelIds.Medic)
            {
                return;
            }

            int ruleBroken = message.CheckRules();

            if (ruleBroken == 20)
            {
                return;
            }

            string ruleBrokenDescription = "ERROR";

            switch (ruleBroken)
            {
            case 1:
                ruleBrokenDescription = "No single-character/emote messages.";
                break;

            case 2:
                ruleBrokenDescription = "No discussion of suicide or rape outside of the designated channels #scream_and_shout or #comfort_and_love.";
                break;

            case 3:
                ruleBrokenDescription = "No hate speech or use of slurs.";
                break;

            case 4:
                ruleBrokenDescription = "No use of Bones' old names.";
                break;

            case 5:
                ruleBrokenDescription = "No trolling.";
                break;

            case 6:
                ruleBrokenDescription = "No advertising or linking to streams or videos outside of #unrelated or #shitpost_memes.";
                break;

            case 7:
                ruleBrokenDescription = "No ALLCAPS messages.";
                break;

            case 8:
                ruleBrokenDescription = "No linking to other Discord servers without permission. Check Rules and Info for more information.";
                break;

            case 9:
                ruleBrokenDescription = "No using Lady Luck outside of the designated channel, #lady_luck.";
                break;

            case 10:
                ruleBrokenDescription = "No using Maymay outside of designated channels: Cute Animals, Chill Chatter, Comfort and Love, and Scream and Shout.";
                break;

            default:
                ruleBrokenDescription = "Fatal error! Report this to Sergeant Ray immediately.";
                break;
            }

            await message.DeleteAsync();

            IMessage scolding = await message.Channel.SendMessageAsync("Violation of Rule " + ruleBroken.ToString() + ": " + ruleBrokenDescription);

            if (scolding == null)
            {
                Console.WriteLine("Bot is not obtaining message properly; scolding is null.");
            }

            await Task.Delay(2000);

            await scolding.DeleteAsync();

            if (ruleBroken == 1 || ruleBroken == 7)
            {
                return;
            }

            ITextChannel logChannel = (message.Author as SocketGuildUser).Guild.GetChannel((ulong)ChannelIds.Log) as ITextChannel;

            await logChannel.SendMessageAsync("User " + message.Author.Mention + " (ID: " + message.Author.Id.ToString() + ") " +
                                              " broke rule " + ruleBroken.ToString() +
                                              " in channel " + message.Channel.Name +
                                              ".\nTime: " + message.Timestamp +
                                              ".\nMessage content:\n\" " + message.Content + " \".");
        }
Ejemplo n.º 2
0
        private async Task CheckRules(SocketMessage message)
        {
            //Prevents Maymay from talking outside of approved channels.
            if (message.Author.Id == 235849760253280257 && !message.Channel.Id.EqualsMulti(Channels.Animal, Channels.Chill, Channels.Vent, Channels.Advice))
            {
                await message.DeleteAsync();
            }

            //Bots are exempt from the rules.
            if (message.Author.IsBot)
            {
                return;
            }

            //Mod and medic chats are also exempt from the rules.
            if (message.Channel.Id == Channels.Mod || message.Channel.Id == Channels.Medic)
            {
                return;
            }

            int ruleBroken = message.CheckRules();

            if (ruleBroken == 20)
            {
                return;
            }

            string ruleBrokenDescription = "ERROR";

            switch (ruleBroken)
            {
            case 1:
                ruleBrokenDescription = "No single-character/emote messages.";
                break;

            case 2:
                ruleBrokenDescription = "No discussion of suicide or rape outside of the designated channels #scream_and_shout or #comfort_and_love.";
                break;

            case 3:
                ruleBrokenDescription = "No hate speech or use of slurs.";
                break;

            case 4:
                //Unused.
                ruleBrokenDescription = "No use of Bones' old names.";
                break;

            case 5:
                //Unused.
                ruleBrokenDescription = "No trolling.";
                break;

            case 6:
                ruleBrokenDescription = "No links outside of designated channels; check Rules and Info for more information.";
                break;

            case 7:
                ruleBrokenDescription = "No ALLCAPS messages. Messages that are mostly ALLCAPS but have one or two lowercase letters still violate this rule.";
                break;

            case 8:
                ruleBrokenDescription = "No linking to other Discord servers without permission. Check Rules and Info for more information.";
                break;

            case 9:
                ruleBrokenDescription = "No using Lady Luck outside of the designated channel, #lady_luck.";
                break;

            case 10:
                ruleBrokenDescription = "No using Maymay outside of designated channels: Cute Animals, Chill Chatter, Comfort and Love, and Scream and Shout.";
                break;

            default:
                //I've maintained Automod since around March or so, and I've never had this one come up.
                ruleBrokenDescription = "Fatal error! Report this to the developer immediately.";
                break;
            }

            await message.DeleteAsync();

            IMessage scolding = await message.Channel.SendMessageAsync("Violation of Rule " + ruleBroken.ToString() + ": " + ruleBrokenDescription);

            await Task.Delay(5000);

            await scolding.DeleteAsync();

            //Don't add violations of rules 1 and 7 to the log, it makes it f*****g impossible to see actual rulebreaks.
            if (ruleBroken == 1 || ruleBroken == 7)
            {
                return;
            }

            ITextChannel logChannel = (message.Author as SocketGuildUser).Guild.GetChannel(Channels.Log) as ITextChannel;

            await logChannel.SendMessageAsync("User " + message.Author.Mention + " (ID: " + message.Author.Id.ToString() + ") " +
                                              " broke rule " + ruleBroken.ToString() +
                                              " in channel " + message.Channel.Name +
                                              ".\nTime: " + message.Timestamp +
                                              ".\nMessage content:\n\" " + message.Content + " \".");
        }