Exemple #1
0
        private static async Task FilterSystem_FilterTriggered(Filter.FilterEventArgs e)
        {
            var stringBuilder = new StringBuilder();

            // Append all the found bad words to the string builder.
            foreach (string str in e.BadWords)
            {
                stringBuilder.Append(str);
                stringBuilder.Append(' ');
            }

            // Create the Discord Embed
            var deb = new DiscordEmbedBuilder()
            {
                Title = "Filter: Word Detected",
                Color = DiscordColor.Red
            };

            deb.WithDescription(String.Format("Filter Trigger(s):```{0}```Excerpt:```{1}```",
                                              stringBuilder.ToString(), e.NotatedMessage));

            deb.AddField(@"Author ID", e.User.Id.ToString(), inline: true);
            deb.AddField(@"Author Username", $"{e.User.Username}#{e.User.Discriminator}", inline: true);
            deb.AddField(@"Author Mention", e.User.Mention, inline: true);
            deb.AddField(@"Channel", e.Channel.Mention, inline: true);
            deb.AddField(@"Timestamp (UTC)", e.Message.CreationTimestamp.UtcDateTime.ToString(Generics.DateFormat), inline: true);
            deb.AddField(@"Link", Generics.GetMessageUrl(e.Message));

            deb.WithThumbnail(Generics.URL_FILTER_BUBBLE);

            // Notify the filter channel.
            await NotifyFilterChannel(deb.Build());
        }
Exemple #2
0
        // When the filter is triggered.
        static void OnFilterTriggered(FilterEventArgs e)
        {
            FilterTriggeredEventHandler handler = FilterTriggered;

            handler?.Invoke(e);
        }