the code reacts to voice state updates that are near the start time of an event and then automatically starts the event.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let events = await lib.discord.scheduledevents['@0.0.1'].list({ guild_id: context.params.event.guild_id });
for (let event of events) {
if (event.channel_id === context.params.event.channel_id && event.status == 1 && new Date(Date.parse(event.scheduled_start_time).valueOf() - 1000 * 60 * 60) < Date.now()) {
await lib.discord.scheduledevents['@0.0.1'].update({ scheduled_event_id: event.id, guild_id: context.params.event.guild_id, status: 'ACTIVE' });
}
}