Example #1
0
        private static void fetchAllServer()
        {
            if (!File.Exists("meta/rankRoles.json"))
            {
                File.Create("meta/rankRoles.json").Dispose();
            }
            RankRoleCollection = JsonConvert.DeserializeObject <Dictionary <ulong, Dictionary <int, ulong> > >(File.ReadAllText("meta/rankRoles.json"));
            if (RankRoleCollection == null)
            {
                RankRoleCollection = new Dictionary <ulong, Dictionary <int, ulong> >();
            }
            List <SocketGuild> guilds = client.Guilds.ToList();

            foreach (SocketGuild guild in guilds)
            {
                if (!RankRoleCollection.ContainsKey(guild.Id))
                {
                    RankRoleCollection.Add(guild.Id, new Dictionary <int, ulong>());
                }
            }
            SaveRankRoleCollection();
        }