Пример #1
0
        public async Task GetBots(IGuildUser target)
        {
            if (target.IsBot)
            {
                await ReplyAsync($"{target.Mention}, BOTs don't have BOTs. Although that would be wild... And I should probably make one. :thinking:");

                return;
            }

            var ownedBots = _botVer.SearchByPredicate(d => d.OwnerId == target.Id && d.Verified == true).ToList();

            if (!ownedBots.Any())
            {
                await ReplyAsync($"{target.Mention}, {target.Nickname??target.Username} does not have any registered BOTs.");

                return;
            }

            var result = new StringBuilder();

            result.Append($"{target.Mention}, {target.Nickname??target.Username} owns the following bots:\n");
            foreach (var vBot in ownedBots)
            {
                var bot = Context.Guild.GetUser(vBot.BotId);
                if (bot is null)
                {
                    continue;
                }
                result.Append($"{bot.Mention}\n");
            }
            result.Append($"_If this list is empty, please notify Peter, because it means the BOT/s got kicked without proper closure._");

            await ReplyAsync(result.ToString());
        }
Пример #2
0
        internal async Task UserLeft(SocketGuildUser user)
        {
            if (user.IsBot && _botVer.IsVerified(user.Id))
            {
                var ownerId = _botVer.SearchByPredicate(d => d.BotId == user.Id && d.Verified == true).FirstOrDefault().OwnerId;
                var owner   = _tutorialServer.GetUser(ownerId);

                if (owner is null)
                {
                    Logger.Log($"[WaitingRoomService] BOT ({user.Username} left the server but I couldn't find the owner with ID {ownerId}. No action will be done...)");
                    return;
                }

                await owner.RemoveRoleAsync(_botDevRole);

                await _generalChannel.SendMessageAsync($"<@!182941761801420802>, I noticed ({user.Username}) left, which is a BOT by {owner.Mention}. So I removed their C# BOT DEV role. :shield:");
            }
            else if (!user.IsBot)
            {
                var ownedBots = _botVer.SearchByPredicate(d => d.OwnerId == user.Id && d.Verified == true).ToList();

                if (!ownedBots.Any())
                {
                    return;
                }

                var kickedBots = new StringBuilder();
                foreach (var botVerification in ownedBots)
                {
                    var id  = botVerification.BotId;
                    var bot = _tutorialServer.GetUser(id);
                    if (bot is null)
                    {
                        continue;
                    }
                    kickedBots.Append($"{bot.Username} ");
                    await bot.KickAsync("The owner left.");
                }

                await _generalChannel.SendMessageAsync($"<@!182941761801420802>, I noticed {user.Username} left. This user's BOTs were also kicked. :shield:");
            }
        }
Пример #3
0
        public async Task Verify()
        {
            if (_botVer.IsVerified(_client.CurrentUser.Id))
            {
                return;
            }

            var verification = _botVer.SearchByPredicate(d => d.BotId == _client.CurrentUser.Id && d.OwnerId == 182941761801420802).FirstOrDefault();

            if (verification == null)
            {
                return;
            }

            await ReplyAsync($"<@!182941761801420802> {verification.VerificationString}");
        }