From 1088c9266a699516e6eacace767ba5bb083cd62c Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:09:01 +1100 Subject: [PATCH] Buhbye `tokens.json`! --- src/commands/music.ts | 7 ++----- src/typings/interfaces.d.ts | 6 ------ 2 files changed, 2 insertions(+), 11 deletions(-) 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,