Ensure commands are only run in specific channels.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Turns comma separated values into a set
// "12345, 56789" -> { '12345', '56789' }
const channelWhitelist = new Set((process.env.CHANNEL_WHITELIST ?? '').split(',').map(id => id.trim()))
if (context.params.event.content === 'ping' && channelWhitelist.has(context.params.event.channel_id))
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `pong`,
});