Пример #1
0
 public void AddRequest(RequestGridItem item)
 {
     _requests.Add(item);
     RequestGrid.RefreshDataSource();
     UpdateRequestFile();
 }
Пример #2
0
 public void AddRequest(RequestGridItem item)
 {
     _requests.Add(item);
     RequestGrid.RefreshDataSource();
     UpdateRequestFile();
 }
Пример #3
0
        public CommandResponse ReadRequest(string user, string url, string mods)
        {
            BeatmapInfo toAdd = null;
            bool isBeatmap = false;
            //Is a beatmap request
            var beatmapMatch = Regex.Match(url, BeatmapRegex);
            if(beatmapMatch.Success)
            {
                var id = beatmapMatch.Groups[1].Value;
                int intID;
                if (!int.TryParse(id, out intID)) return CommandResponse.None;
                toAdd = BeatmapFetcher.FetchBeatmapInfo(intID);
                isBeatmap = true;
            }

            var setMatch = Regex.Match(url, SongRegex);
            if(setMatch.Success)
            {
                var id = setMatch.Groups[1].Value;
                int intID;
                if (!int.TryParse(id, out intID)) return CommandResponse.None;
                var set = BeatmapFetcher.FetchSetInfo(intID);
                toAdd = (set.Length >= 1 ? set[set.Length - 1] : null);
            }

            if(toAdd == null) return CommandResponse.None;

            RequestGridItem rgi = new RequestGridItem { User = user, RequestDate = DateTime.Now, Artist = toAdd.artist, Song = toAdd.title, Creator = toAdd.creator, Link = CreateOsuDirectURL(toAdd.beatmapset_id), Website = CreateWebsiteURL(isBeatmap ? toAdd.beatmap_id : toAdd.beatmapset_id, isBeatmap), Mods = mods, Difficulty = (setMatch.Success ? "" : toAdd.version), Ranked = (toAdd.approved != -1) };
            NewRequestEvent.Invoke(rgi);
            return new CommandResponse(CommandResponse.ResponseAction.None);
        }
Пример #4
0
        /// <summary>
        /// A song request was PM'd to the Osu Bot
        /// </summary>
        /// <param name="rgi"></param>
        void Commands_NewRequestEvent(RequestGridItem rgi)
        {
            if (!Global.o_receiveRequests) return;
            if (Global.t_forwardRequests && twitchBot.Running)
                twitchBot.SendMessage(string.Format("Map '{0} - {1}' requested by {2}(Osu) was added to queue.", rgi.Artist, rgi.Song, rgi.User));

            _requests.Add(rgi);
            Log("Added entry: " + rgi.Link);
            RefreshGrid();
        }