This snippet grants the mentioned user the VIP role for 20 seconds and removes it afterwards. This can be used to let the user bypass AutoMod. Please set your project max timeout to 30000 or higher
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
mention = context.params.event.content.replace('!permit ', '');
console.log(`[Mention]:`, mention);
let sleep = async (ms) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms || 0);
});
};
await lib.twitch.chat['@1.0.0'].messages.create({
channel_id: `${context.params.event.channel.id}`,
content: `/vip ${mention}`,
});
await lib.twitch.chat['@1.0.0'].messages.create({
channel_id: `${context.params.event.channel.id}`,
content: `${mention} You now have 20 seconds to post a link! GO GO GO ๐`,
});
await sleep(20000);
await lib.twitch.chat['@1.0.0'].messages.create({
channel_id: `${context.params.event.channel.id}`,
content: `/unvip ${mention}`,
});
await lib.twitch.chat['@1.0.0'].messages.create({
channel_id: `${context.params.event.channel.id}`,
content: `๐ ${mention} Your time is over! ๐`,
});