This is a command that converts any money currency to another currency, this is very useful for people who dont have to go to google to search, all you need to do is make a slash command and put the required options, [amount] [from] [to].
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const axios = require('axios');
const event = context.params.event;
const amount = context.params.event.data.options[0].value;
const fro = context.params.event.data.options[1].value;
const to = context.params.event.data.options[2].value;
const {data} = await axios(
`https://apiv2.spapi.ga/fun/currency?amount=${amount}&from=${fro}&to=${to}`
);
console.log(data);
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `π± Currency Converter π±`,
description: '',
color: 0xe430e7,
fields: [
{
name: `From: ${fro}`,
value: `> ${amount}`,
},
{
name: `To: ${to}`,
value: `> ${data.convertion.converted}`,
},
],
timestamp: `${context.params.event.received_at}`,
footer: {
text: `Requested by ${event.member.user.username}`,
},
},
],
});