playing.ts
1 import { Precondition } from 'amethystjs'; 2 import { players } from '../cache/players'; 3 4 export default new Precondition('playing').setChatInputRun(({ interaction }) => { 5 if (interaction.replied || interaction.deferred) 6 return { ok: false, message: 'Already handled', type: 'chatInput', interaction }; 7 const queue = players.has(interaction.guild.id); 8 if (!interaction.guild || !interaction.guild.members.me?.voice?.channel || !queue) { 9 return { 10 ok: false, 11 message: 'Not playing', 12 type: 'chatInput', 13 interaction, 14 metadata: { 15 message: interaction.client.langs.getText(interaction, 'preconditions', 'playing') 16 } 17 }; 18 } 19 return { 20 ok: true, 21 type: 'chatInput', 22 interaction 23 }; 24 });