private String[] expensiveSearchTerms = { "artist", "album", "track", "playlist" };  //Specify expensive search terms for optimizing api 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(() => _api = new SpotifyApi(_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);

            //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(_api, false))
                       );
        }
 //Return a generic reconnection action
 private Action reconnectAction(SpotifyApi api, bool keepRefreshToken = true)
 {
     return(() =>
     {
         Task connectTask = api.ConnectWebApi(keepRefreshToken);
         //Assign client ID asynchronously when connection finishes
         connectTask.ContinueWith((connectResult) => {
             try{
                 currentUserId = api.GetUserID();
             }
             catch {
                 Console.WriteLine("Failed to write client ID");
             }
         });
     });
 }