Use ?cal-list to list the 10 closest calendar events(10 because character limits)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let events = await lib.gcal.events['@3.0.2'].list();
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: context.params.event.channel_id,
content: ``,
embeds: [
{
type: 'rich',
title: 'Google Calendar Events',
description: events.items.map((e, i) =>
`**__${i + 1}. [${e.summary}](${e.htmlLink})__** \`(${e.id})\`
**Starts:** | ${e.start.dateTime ?
` to `
: `All Day `}
**Organised By:** ${e.organizer.email}
**More Info:** ${e.description}`).slice(0, 10) .join('\n\n'),
color: 0x00ffff,
timestamp: new Date().toISOString(),
footer: {
text: `${context.params.event.author.username}#${context.params.event.author.discriminator}`,
icon_url: context.params.event.author.avatar
? `https://cdn.discordapp.com/avatars/${context.params.event.author.id}/${context.params.event.author.avatar}.png`
: 'https://bit.ly/3KPnEKt',
},
},
],
});