diff --git a/src/commands/music.ts b/src/commands/music.ts index a360b08..bade487 100644 --- a/src/commands/music.ts +++ b/src/commands/music.ts @@ -1,18 +1,15 @@ import Discord from 'discord.js'; import TClient from '../client.js'; +import TSClient from '../helpers/TSClient.js'; import {Player,useTimeline,useQueue} from 'discord-player'; import {SpotifyExtractor} from '@discord-player/extractor'; -import {readFileSync} from 'node:fs'; -import {Tokens} from 'src/typings/interfaces'; -const token:Tokens = JSON.parse(readFileSync('src/tokens.json', 'utf8')); -// TODO: Fix above. export default { async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ if (!client.config.botSwitches.music && !client.config.whitelist.includes(interaction.user.id)) return interaction.reply({content:'Music module is currently disabled.',ephemeral:true}); if (!client.isStaff(interaction.member) && !client.config.whitelist.includes(interaction.member.id)) return interaction.reply('Music module is close to being completed, some parts may be incomplete or broken, so it has been restricted to staff for time-being.'); const player = Player.singleton(client); - await player.extractors.register(SpotifyExtractor,{clientId: token.spotify.client, clientSecret: token.spotify.secret}); + await player.extractors.register(SpotifyExtractor,{clientId: (await TSClient.Token()).spotify.client, clientSecret: (await TSClient.Token()).spotify.secret}); if (!interaction.member.voice.channel) return interaction.reply('Please join a voice channel first to use the command.'); player.nodes.create(interaction.guildId, { metadata: { diff --git a/src/typings/interfaces.d.ts b/src/typings/interfaces.d.ts index 12573eb..56c4c82 100644 --- a/src/typings/interfaces.d.ts +++ b/src/typings/interfaces.d.ts @@ -111,12 +111,6 @@ export interface FSCareerSavegame { interface XMLText { _text: string } -export interface Tokens { - spotify: { - client: string, - secret: string - } -} export interface Config { embedColor: Discord.ColorResolvable, embedColorGreen: Discord.ColorResolvable,