A basic command for browsing Amazon on Discord! Type "?amazon <your item>" in your server and receive a link to a search page on Amazon!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let search = context.params.event.content.split(' ').splice(1).join('%20');
let result = `https://www.amazon.com/s?k=${search}&ref=nb_sb_noss_2`;
let message = context.params.event.content;
if (message.startsWith(`?amazon`)) { //you can change the prefix
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
type: 'rich',
title: `Click here!`,
description: '',
color: 0xff0000,
url: `https://www.amazon.com/s?k=${search}&ref=nb_sb_noss_2`,
},
],
});
}
//ty Kangabru for the help :)