Ever thought Autocode could use more customizable scheduler intervals? Well this code will send a message to the Discord server that you have defined in guild_id every 2 hours. Make sure you fill in your guild (server) id and the channel id in the code below.
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Grabbing the new time
if (new Date().getHours() % 2 === 0) {
// The message
await lib.discord.channels['@0.1.1'].messages.create({
guild_id: `Guild ID here`,
channel_id: `Channel ID here`,
content: `Congrats on seeing this scheduler work every 2 hours!`,
});
}