You can now count messages a user has sent with this simple snippet
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let start = 0;
let result = await lib.utils.kv['@0.1.16'].get({
key: `messages${context.params.event.author.id}`,
defaultValue: start,
});
await lib.utils.kv['@0.1.16'].set({
key: `messages${context.params.event.author.id}`,
value: result + 1,
});
if (context.params.event.content === '!messages') {
await lib.discord.channels['@0.2.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `You have sent ${result} messages`,
});
}