mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-16 20:00:59 -05:00
Add botSwitch for music module
This commit is contained in:
parent
6bb55fb175
commit
e3c4b50c87
@ -4,6 +4,7 @@ import {Player,useTimeline,useQueue} from 'discord-player';
|
||||
import {SpotifyExtractor} from '@discord-player/extractor';
|
||||
export default {
|
||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
if (!client.config.botSwitches.music) 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('This command is in early stages of development, some parts may be missing or broken.\nIt has been restricted to staff for time-being.');
|
||||
const player = Player.singleton(client);
|
||||
await player.extractors.register(SpotifyExtractor, {
|
||||
|
@ -19,6 +19,7 @@
|
||||
"registerCommands": true,
|
||||
"commands": true,
|
||||
"logs": true,
|
||||
"music": false,
|
||||
"buttonRoles": true,
|
||||
"automod": true,
|
||||
"mpstats": true,
|
||||
|
22
src/index.ts
22
src/index.ts
@ -41,16 +41,18 @@ process.on('error', (error: Error)=>DZ(error, 'process-error'));
|
||||
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
||||
|
||||
// Audio Player event handling
|
||||
player.events.on('playerStart', (queue,track)=>queue.channel.send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle(`${track.raw.title} - ${track.raw.author}`).setFooter({text:`Playing in ${queue.channel.name}`}).setThumbnail(track.raw.thumbnail)]}));
|
||||
player.events.on('playerFinish', (queue,track)=>{
|
||||
if (queue.tracks.size < 1) return queue.channel.send('There\'s no songs left in the queue, leaving voice channel in 15 seconds.').then(()=>setTimeout(()=>queue.connection.disconnect(), 15000))
|
||||
})
|
||||
player.events.on('audioTrackAdd', (queue,track)=>queue.channel.send({embeds:[new client.embed().setColor(client.config.embedColorGreen).setTitle(`${track.raw.title} - ${track.raw.author}`).setFooter({text:`Added to queue`}).setThumbnail(track.raw.thumbnail)]}));
|
||||
/* player.events.on('debug', (queue,message)=>{
|
||||
console.log(client.logTime(), message)
|
||||
}) */
|
||||
player.events.on('playerError', (queue, error)=>DZ(error, 'playerError'));
|
||||
player.events.on('error', (queue, error)=>DZ(error, 'playerInternalError'));
|
||||
if (client.config.botSwitches.music){
|
||||
player.events.on('playerStart', (queue,track)=>queue.channel.send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle(`${track.raw.title} - ${track.raw.author}`).setFooter({text:`Playing in ${queue.channel.name}`}).setThumbnail(track.raw.thumbnail)]}));
|
||||
player.events.on('playerFinish', (queue,track)=>{
|
||||
if (queue.tracks.size < 1) return queue.channel.send('There\'s no songs left in the queue, leaving voice channel in 15 seconds.').then(()=>setTimeout(()=>queue.connection.disconnect(), 15000))
|
||||
})
|
||||
player.events.on('audioTrackAdd', (queue,track)=>queue.channel.send({embeds:[new client.embed().setColor(client.config.embedColorGreen).setTitle(`${track.raw.title} - ${track.raw.author}`).setFooter({text:`Added to queue`}).setThumbnail(track.raw.thumbnail)]}));
|
||||
/* player.events.on('debug', (queue,message)=>{
|
||||
console.log(client.logTime(), message)
|
||||
}) */
|
||||
player.events.on('playerError', (queue, error)=>DZ(error, 'playerError'));
|
||||
player.events.on('error', (queue, error)=>DZ(error, 'playerInternalError'));
|
||||
}
|
||||
|
||||
// YouTube Upload notification and Daggerwin MP loop
|
||||
setInterval(()=>MPLoop(client, client.config.MPStatsLocation.channel, client.config.MPStatsLocation.message, 'Daggerwin'), 60000);
|
||||
|
1
src/typings/interfaces.d.ts
vendored
1
src/typings/interfaces.d.ts
vendored
@ -144,6 +144,7 @@ export interface Config {
|
||||
registerCommands: boolean,
|
||||
commands: boolean,
|
||||
logs: boolean,
|
||||
music: boolean,
|
||||
buttonRoles: boolean,
|
||||
automod: boolean,
|
||||
mpstats: boolean,
|
||||
|
Loading…
Reference in New Issue
Block a user