UNPKG

@getsolara/solara.voice

Version:

Optional voice functionality for @getsolara/solara.js using @discordjs/voice

22 lines (21 loc) 828 B
module.exports = { name: "$voiceGetVolume", description: "Gets the stored playback volume (0-200).", takesBrackets: false, execute: async (context, args) => { if (context.client.voiceInitialized === false) { return "100"; } if (!context.guild) return "100"; const guildId = context.guild.id; const storedVolumeFactor = context.client.solaraVoiceVolumes?.get(guildId); if (storedVolumeFactor !== undefined) { return Math.round(storedVolumeFactor * 100).toString(); } const player = context.client.solaraAudioPlayers?.get(guildId); if (player?.state?.resource?.volume) { return Math.round(player.state.resource.volume.volume * 100).toString(); } return "100"; } };