示例#1
0
    public override void Handle()
    {
        Regex pattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, @"\s\S+$");
        if (pattern.IsMatch(ChatMessage.Message))
        {
            Response = $"{ChatMessage.Username}, {SpotifyRequest.AddToQueue(ChatMessage.Channel.Name, ChatMessage.Split[1]).Result}";
            return;
        }

        pattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, "\s\w+\s\w+");
        if(pattern.IsMatch(ChatMessage.Message))
        {
            if (DbController.DoesSpotifyUserExist(ChatMessage.Split[2]))
            {
                Response = $"{ChatMessage.Username}, {SpotifyRequest.AddToQueue(ChatMessage.LowerSplit[1], SpotifyRequest.GetCurrentlyPlayingTrack(ChatMessage.Split[2]), false).Result};
            }
        }

        pattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, @"\s\w+\s\S+");
        if (pattern.IsMatch(ChatMessage.Message))
        {
            Response = $"{ChatMessage.Username}, {SpotifyRequest.AddToQueue(ChatMessage.LowerSplit[1], ChatMessage.Split[2], false).Result}";
        }
    }
}
示例#2
0
    public override void Handle()
    {
        Regex pattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, @"\s\w+");

        if (pattern.IsMatch(ChatMessage.Message))
        {
            string response = Task.Run(async() => await SpotifyRequest.ListenTo(ChatMessage.Username, ChatMessage.LowerSplit[1])).Result;
            Response = $"{ChatMessage.Username}, {response}";
            return;
        }
    }
示例#3
0
    public override void Handle()
    {
        Regex pattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix);

        if (pattern.IsMatch(ChatMessage.Message))
        {
            Response = $"{ChatMessage.Username}, ";
            if (ChatMessage.IsModerator || ChatMessage.IsBroadcaster)
            {
                Response += SpotifyRequest.SkipToNextSong(ChatMessage.Channel.Name).Result;
            }
            else
            {
                Response += "you have to be a mod or the broadcaster to skip the song";
            }
        }
    }
示例#4
0
    public override void Handle()
    {
        Regex searchPattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, @"\ssearch\s.+");

        if (searchPattern.IsMatch(ChatMessage.Message))
        {
            string query = ChatMessage.Split.Skip(2).JoinToString(' ');
            Response = $"{ChatMessage.Username}, {SpotifyRequest.Search(query).Result}";
            return;
        }

        Regex currentPlayingPattern = PatternCreator.Create(Alias, ChatMessage.Channel.Prefix, @"(\s\w+)?");

        if (currentPlayingPattern.IsMatch(ChatMessage.Message))
        {
            string username = ChatMessage.LowerSplit.Length > 1
                ? (ChatMessage.LowerSplit[1] == "me"
                    ? ChatMessage.Username
                    : ChatMessage.LowerSplit[1])
                : ChatMessage.Channel.Name;
            Response = $"{ChatMessage.Username}, {SpotifyRequest.GetCurrentlyPlaying(username).Result}";
        }
    }