Want to search for snippet in autocode but do not want to enter the site now and search !? Just write! Search {your search} and here you go!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let search = context.params.event.content.split(' ').splice(1).join('%20');
let result = `https://autocode.com/snippet/?q=${search}`;
let message = context.params.event.content;
const Time = new Date().toISOString();
if (message.startsWith(`${process.env.prefix}search`)) {
//you can change the prefix
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
components: [
{
type: 1,
components: [
{
style: 5,
label: `Here your search!`,
url: `https://autocode.com/snippet/?q=${search}`,
disabled: false,
type: 2,
},
],
},
],
embeds: [
{
type: 'rich',
title: `__Snippet Search Autocode__`,
description: `Just click on the button (:`,
color: 0x111111,
thumbnail: {
url: `https://cdn.discordapp.com/emojis/831239843027615835.png?size=44`,
height: 0,
width: 0,
},
},
],
timestamp: `${Time}`,
footer: {
text: `Search`,
},
});
}