private String[] expensiveSearchTerms = { "artist", "album", "track", "playlist", "queue" };  //Specify expensive search terms for optimizing client usage
        //Wait for delay before querying

        public void Init(PluginInitContext context)
        {
            _context      = context;
            lastQueryTime = DateTime.UtcNow;

            // initialize data, passing it the plugin directory
            Task.Run(() => _client = new SpotifyPluginClient(_context.CurrentPluginMetadata.PluginDirectory));

            _terms.Add("artist", SearchArtist);
            _terms.Add("album", SearchAlbum);
            _terms.Add("playlist", SearchPlaylist);
            _terms.Add("track", SearchTrack);
            _terms.Add("next", PlayNext);
            _terms.Add("last", PlayLast);
            _terms.Add("pause", Pause);
            _terms.Add("play", Play);
            _terms.Add("mute", ToggleMute);
            _terms.Add("vol", SetVolume);
            _terms.Add("volume", SetVolume);
            _terms.Add("device", GetDevices);
            _terms.Add("shuffle", ToggleShuffle);
            _terms.Add("queue", QueueSearch);

            //view query count and average query duration
            _terms.Add("diag", q =>
                       SingleResult($"Query Count: {context.CurrentPluginMetadata.QueryCount}",
                                    $"Avg. Query Time: {context.CurrentPluginMetadata.AvgQueryTime}ms",
                                    null));

            _terms.Add("reconnect", q =>
                       SingleResult("Reconnect", "Force a reconnection and remove the refresh token", reconnectAction(_client, false))
                       );
        }
 //Return a generic reconnection action
 private Action reconnectAction(SpotifyPluginClient client, bool keepRefreshToken = true)
 {
     return(() =>
     {
         Task connectTask = client.ConnectWebClient(keepRefreshToken);
         //Assign client ID asynchronously when connection finishes
         connectTask.ContinueWith((connectResult) => {
             try{
                 currentUserId = client.UserID;
             }
             catch {
                 Console.WriteLine("Failed to write client ID");
             }
         });
     });
 }