Beispiel #1
0
        private static async Task <int> CheckJoinedGuilds(DiscordSocketClient shard = null)
        {
            IReadOnlyCollection <SocketGuild> guilds;

            if (shard == null)
            {
                guilds = Client.Guilds;
            }
            else
            {
                guilds = shard.Guilds;
            }

            var existingIds = ServerDb.GetNotLeft();
            var newIds      = guilds.Where(x => !existingIds.Contains(x.Id)).Select(x => x.Id);

            int addedBal = await BalanceDb.AddNewServerBotBalance(newIds, Client.CurrentUser.Id);

            int added = await ServerDb.AddNewServers(newIds, AppSettings.DefaultPrefix);

            return(added);
        }