Flatlogic Bot ca3a32f23e V 4
2026-02-16 06:55:36 +00:00

67 lines
1.9 KiB
TypeScript

import * as spotify_uri from 'spotify-uri';
import { InfoExtractorPlugin, ResolveOptions, Song, Playlist as Playlist$1 } from 'distube';
declare const SUPPORTED_TYPES: readonly ["album", "playlist", "track", "artist"];
type Track = {
type: "track";
id: string;
name: string;
artists: {
name: string;
}[];
thumbnail?: string;
duration: number;
};
type DataList = {
type: string;
name: string;
thumbnail?: string;
url: string;
tracks: Track[];
};
type Album = DataList & {
type: "album";
};
type Playlist = DataList & {
type: "playlist";
};
type Artist = DataList & {
type: "artist";
};
type TrackList = Album | Playlist | Artist;
type Data = Track | TrackList;
declare class API {
#private;
private _hasCredentials;
private _expirationTime;
private _tokenAvailable;
topTracksCountry: string;
constructor(clientId?: string, clientSecret?: string, topTracksCountry?: string);
isSupportedTypes(type: string): type is (typeof SUPPORTED_TYPES)[number];
refreshToken(): Promise<void>;
parseUrl(url: string): spotify_uri.ParsedSpotifyUri;
getData(url: `${string}/track/${string}`): Promise<Track>;
getData(url: `${string}/album/${string}`): Promise<Album>;
getData(url: `${string}/playlist/${string}`): Promise<Playlist>;
getData(url: `${string}/artist/${string}`): Promise<Artist>;
getData(url: string): Promise<Data>;
}
type SpotifyPluginOptions = {
api?: {
clientId?: string;
clientSecret?: string;
topTracksCountry?: string;
};
};
declare class SpotifyPlugin extends InfoExtractorPlugin {
api: API;
constructor(options?: SpotifyPluginOptions);
validate(url: string): boolean;
resolve<T>(url: string, options: ResolveOptions<T>): Promise<Song<T> | Playlist$1<T>>;
createSearchQuery<T>(song: Song<T>): string;
getRelatedSongs(): never[];
}
export { SpotifyPlugin, type SpotifyPluginOptions, SpotifyPlugin as default };