Exemple #1
0
        internal static async Task MessageDeleted(Discord.Cacheable <Discord.IMessage, ulong> cachedMsg, ISocketMessageChannel channel)
        {
            if (cachedMsg.HasValue)
            {
                var imsg = cachedMsg.Value;

                if (imsg is SocketUserMessage msg)
                {
                    SocketCommandContext context = new SocketCommandContext(Globals.discord, msg);
                    bool suspicious = await OwlBrain.EvaluateSuspiciousness(context, msg);

                    if (suspicious)
                    {
                        await OwlBrain.ReportSuspicious(context, msg, "Suspicious message was deleted");
                    }
                }
            }
        }
Exemple #2
0
        internal static async Task WatchForQuickReconnect(SocketGuildUser user)
        {
            ulong userId = user.Id;

            //run this in another thread to not block the gateway thread

            (new Thread(() =>
            {
                // wait some time
                int minutes = 10;
                Thread.Sleep(1000 * 60 * minutes);

                var guild = user.Guild;
                var dl = guild.DownloadUsersAsync();
                dl.Wait();

                var userReturned = guild.Users.FirstOrDefault(iterator => iterator.Id == userId);
                if (userReturned != null)
                {
                    var rps = OwlBrain.ReportSuspicious(guild, null, user, null, $"User has left the server and rejoined within {minutes} minute{(minutes > 1 ? "s" : "")}. Ban/Role evade attempt?");
                    rps.Wait();
                }
            })).Start();
        }