2020-06-13 09:33:44 -05:00
|
|
|
export default async function(server, discordClient, channelID, events = []) {
|
2020-06-13 11:35:00 -05:00
|
|
|
if (!server) throw new Error('DiscordDebug must be provided with a reference to the server.');
|
2020-05-15 12:42:39 -05:00
|
|
|
|
2020-06-13 11:35:00 -05:00
|
|
|
if (!discordClient) throw new Error('DiscordDebug must be provided with a Discord.js client.');
|
2020-05-15 12:42:39 -05:00
|
|
|
|
2020-06-13 11:35:00 -05:00
|
|
|
if (!channelID) throw new Error('DicordDebug must be provided with a channel ID.');
|
2020-05-15 12:42:39 -05:00
|
|
|
|
|
|
|
const channel = await discordClient.channels.fetch(channelID);
|
|
|
|
|
|
|
|
for (const event of events) {
|
|
|
|
server.on(event, info => {
|
|
|
|
channel.send(`\`\`\`${JSON.stringify(info, null, 2)}\`\`\``);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|