Prefix command for instant money without cooldown. Snippet for this economy app https://autocode.com/app/starsblaster/economy-app/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
module.exports = async (event, context) => {
if (event.content.startsWith(`${process.env.prefix}work`)) {
let database = await lib.googlesheets.query['@0.3.0'].distinct({
range: `A:E`,
bounds: `FIRST_EMPTY_ROW`,
where: [
{
user_id__is: event.author.id,
},
],
field: `money`,
});
await lib.googlesheets.query['@0.3.0'].update({
range: `A:F`,
bounds: 'FIRST_EMPTY_ROW',
where: [
{
user_id__is: event.author.id,
},
],
fields: {
money: parseInt(database.distinct.values[0]) + 300,
},
});
await lib.discord.channels['@0.1.1'].messages.create({
channel_id: event.channel_id,
content: `You erned 300💰`,
});
}
};