mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 23:24:26 -05:00
16 lines
574 B
JavaScript
16 lines
574 B
JavaScript
export default async function(server, discordClient, channelID, events = []) {
|
|
if (!server) throw new Error('DiscordDebug must be provided with a reference to the server.');
|
|
|
|
if (!discordClient) throw new Error('DiscordDebug must be provided with a Discord.js client.');
|
|
|
|
if (!channelID) throw new Error('DicordDebug must be provided with a channel ID.');
|
|
|
|
const channel = await discordClient.channels.fetch(channelID);
|
|
|
|
for (const event of events) {
|
|
server.on(event, info => {
|
|
channel.send(`\`\`\`${JSON.stringify(info, null, 2)}\`\`\``);
|
|
});
|
|
}
|
|
}
|