A piece of code that gets the ID of the voice channel a user is in at any moment. Use utils.kv.get to retrieve the ID in any other file.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
if (context.params.event.channel_id !== null) {
await lib.utils.kv.set({
key: `currentVC_${context.params.event.member.user.id}`,
value: `${context.params.event.channel_id}`,
ttl: 604800, //1 week
});
} else if (context.params.event.channel_id === null) {
await lib.utils.kv.clear({
key: `currentVC_${context.params.event.member.user.id}`,
});
}
/*
use this in other files where you need the ID
let VcId = await lib.utils.kv.get({
key: `currentVC_${USERID}`, //remember to replace the USERID with your placeholder e.g ${context.params.event.member.user.id}
defaultValue: null,
});
*/