twitch_bot/commands/sketch.js

41 lines
947 B
JavaScript
Raw Normal View History

const command = {
name: "sketch",
desc: "make a suspicious link",
2023-02-02 23:37:42 +01:00
restricted: false,
2023-02-02 23:58:58 +01:00
mod: false,
run: async (client, msg, splitted) => {
if (!splitted[2]) {
2023-02-04 17:21:55 +01:00
await client.say(
msg.channelName,
`${msg.displayName}, please supply an URL PoroSad`
);
return;
}
let formData = new FormData();
2023-02-02 14:16:21 +01:00
formData.append(
"long_url",
splitted[2].startsWith("https://") || splitted[2].startsWith("http://")
? splitted[2]
: `https://${splitted[2]}`
);
const data = await fetch(
`https://verylegit.link/sketchify?long_url=twitter.com`,
{
body: formData,
method: "POST",
}
)
.then((res) => res.text())
2023-02-11 13:48:05 +01:00
.catch((err) => console.error("Error sketchifying url: " + err.message));
2023-02-11 13:48:05 +01:00
await client.say(
msg.channelName,
`${msg.displayName}, sketchified URL: ${data}`
);
},
};
2023-02-01 22:11:48 +01:00
module.exports = { command };