Пример #1
0
        private async void ShowcaseVerificationGate(SocketCommandContext context)
        {
            if (context.User.Id == Constants.JustineId)
            {
                return;
            }

            if (context.Channel.Id != Constants.TutorialBotShowcaseChannelId)
            {
                return;
            }

            if (!context.User.IsBot)
            {
                return;
            }

            if (_botVer.IsVerified(context.User.Id))
            {
                return;
            }

            await context.Message.DeleteAsync();

            await context.Channel.SendMessageAsync($"The {context.User.Mention} <:bot:400105688967413781> is not verified. Only verified bots can respond in this channel.");
        }
Пример #2
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}");
        }
Пример #3
0
        public async Task GetUnverifiedBots()
        {
            var bots = Context.Guild.Users.Where(u => u.IsBot && !_botVer.IsVerified(u.Id)).Select(b => b.Mention);

            if (bots.Count() == 0)
            {
                await ReplyAsync("There are no unverified bots on this server.");

                return;
            }

            try
            {
                await ReplyAsync($"Theses are the unverified bots of this server:\n{string.Join("\n", bots)}");
            }
            catch (Exception)
            {
                await ReplyAsync("There are too many unverified bots to list on this server.");
            }
        }
Пример #4
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:");
            }
        }