mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-29 09:54:26 -05:00
37 lines
920 B
JavaScript
37 lines
920 B
JavaScript
export default {
|
|
name: 'discord-debug',
|
|
description: 'Dump SquadJS events to Discord.',
|
|
defaultDisabled: true,
|
|
|
|
optionsSpec: {
|
|
discordClient: {
|
|
type: 'DiscordConnector',
|
|
required: true,
|
|
default: 'discord',
|
|
description: 'The name of the Discord Connector to use.'
|
|
},
|
|
channelID: {
|
|
type: 'Discord Channel ID',
|
|
required: true,
|
|
default: 'Discord Channel ID',
|
|
description: 'The ID of the channel to log admin broadcasts to.'
|
|
},
|
|
events: {
|
|
type: 'Array',
|
|
required: true,
|
|
default: [],
|
|
description: 'A list of events to dump.'
|
|
}
|
|
},
|
|
|
|
init: async (server, options) => {
|
|
const channel = await options.discordClient.channels.fetch(options.channelID);
|
|
|
|
for (const event of options.events) {
|
|
server.on(event, (info) => {
|
|
channel.send(`\`\`\`${JSON.stringify(info, null, 2)}\`\`\``);
|
|
});
|
|
}
|
|
}
|
|
};
|