Prefix command that responds with the id of the mentioned user, role or channel.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.content.toLowerCase().startsWith(`!viewid`)) {
let mention = context.params.event.content.split(' ')[1];
if (!mention || !mention.startsWith('<')) {
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `You must mention a user, role, or channel to use this command.`
});
return;
}
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${mention}'s id is ${mention.replace(/[<>@!]/gi, '')}`
});
}