An example of a prefix command that only works for specific users
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Edit these to be the ids of the users you want to allow
const ALLOWED_USER_IDS = [
'SPECIFIC_USER_ID_1',
'SPECIFIC_USER_ID_2',
'SPECIFIC_USER_ID_3'
];
if (context.params.event.content.startsWith('!restricted')) {
if (ALLOWED_USER_IDS.includes(context.params.event.author.id)) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Congratulations, <@!${context.params.event.author.id}>! You are one of the chosen ones.`
});
} else {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Sorry, you don't have permission to use this command.`
});
}
}