Esempio n. 1
0
        public static void Watch(ISocketMessageChannel channel, string[] args)
        {
            if (args.Length <= 0)
            {
                channel.SendMessageAsync($"Please provide a username to watch a profile for.");
                return;
            }
            var uuid      = Minecraft.UsernameToUuid(args[0])["id"].Value <string>();
            var jProfiles = Hypixel.Player(uuid)["player"]["stats"]["SkyBlock"]["profiles"];

            var profiles = new Dictionary <string, string>();
            var options  = new List <string>();

            foreach (var prof in jProfiles)
            {
                var i    = profiles.Count + 1;
                var p    = prof.First();
                var id   = p["profile_id"].Value <string>();
                var name = p["cute_name"].Value <string>();
                profiles.Add(name, id);
                options.Add(name);
            }

            channel.SendMultipleChoiceAsync("These are the profiles i found", options, option =>
            {
                profiles.TryGetValue(option, out var id);
                var profile = Hypixel.SkyblockProfile(id)["profile"];
                HypixelSkybot.Create(channel, profile);
                channel.SendMessageAsync("Im now watching " + option + " in this channel");
            });
        }
        private void TimerTick()
        {
            var profile = Hypixel.SkyblockProfile(_skyblockId);

            for (int i = 0; i < _users.Count; i++)
            {
                var member = profile["profile"]["members"][_users[i].UserId];
                _users[i].Update(member);
            }
        }
        public HypixelSkybot(ISocketMessageChannel channel, JToken user)
        {
            _channel    = channel;
            _skyblockId = user["profile_id"].Value <string>();
            if (_timer == null)
            {
                _timer           = new Timer(30000);
                _timer.AutoReset = true;
                _timer.Elapsed  += (sender, eventArgs) => TimerTick();
                _timer.Start();
            }

            var profile = Hypixel.SkyblockProfile(_skyblockId);

            foreach (var member in profile["profile"]["members"])
            {
                var uuid     = member.Name();
                var username = Minecraft.UuidToUsername(uuid).Last["name"].Value <string>();
                _users.Add(new ProfileUser(_channel, uuid, username));
            }

            TimerTick();
        }