mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -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';
|
import {SpotifyExtractor} from '@discord-player/extractor';
|
||||||
export default {
|
export default {
|
||||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
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.');
|
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);
|
const player = Player.singleton(client);
|
||||||
await player.extractors.register(SpotifyExtractor, {
|
await player.extractors.register(SpotifyExtractor, {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"registerCommands": true,
|
"registerCommands": true,
|
||||||
"commands": true,
|
"commands": true,
|
||||||
"logs": true,
|
"logs": true,
|
||||||
|
"music": false,
|
||||||
"buttonRoles": true,
|
"buttonRoles": true,
|
||||||
"automod": true,
|
"automod": true,
|
||||||
"mpstats": true,
|
"mpstats": true,
|
||||||
|
18
src/index.ts
18
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'));
|
client.on('error', (error: Error)=>DZ(error, 'client-error'));
|
||||||
|
|
||||||
// Audio Player event handling
|
// 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)]}));
|
if (client.config.botSwitches.music){
|
||||||
player.events.on('playerFinish', (queue,track)=>{
|
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))
|
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('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)=>{
|
/* player.events.on('debug', (queue,message)=>{
|
||||||
console.log(client.logTime(), message)
|
console.log(client.logTime(), message)
|
||||||
}) */
|
}) */
|
||||||
player.events.on('playerError', (queue, error)=>DZ(error, 'playerError'));
|
player.events.on('playerError', (queue, error)=>DZ(error, 'playerError'));
|
||||||
player.events.on('error', (queue, error)=>DZ(error, 'playerInternalError'));
|
player.events.on('error', (queue, error)=>DZ(error, 'playerInternalError'));
|
||||||
|
}
|
||||||
|
|
||||||
// YouTube Upload notification and Daggerwin MP loop
|
// YouTube Upload notification and Daggerwin MP loop
|
||||||
setInterval(()=>MPLoop(client, client.config.MPStatsLocation.channel, client.config.MPStatsLocation.message, 'Daggerwin'), 60000);
|
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,
|
registerCommands: boolean,
|
||||||
commands: boolean,
|
commands: boolean,
|
||||||
logs: boolean,
|
logs: boolean,
|
||||||
|
music: boolean,
|
||||||
buttonRoles: boolean,
|
buttonRoles: boolean,
|
||||||
automod: boolean,
|
automod: boolean,
|
||||||
mpstats: boolean,
|
mpstats: boolean,
|
||||||
|
Loading…
Reference in New Issue
Block a user