Add fancy new image button to Skyline

This commit is contained in:
= 2021-11-25 13:19:46 +01:00
parent 4797cbcd9f
commit 73f681b294

View file

@ -201,12 +201,24 @@ client.on("interactionCreate", (int) => {
} else if(int.commandName == "bonk"){
int.reply(`*${int.user.username} bonked ${int.options.getUser("user").username}* <a:getbonked:912473583488499743>`);
} else if(int.commandName == "cat"){
const row = new dc.MessageActionRow();
const btn = new dc.MessageButton();
btn.setCustomId("cat-" + Math.round(Math.random()*99999));
btn.setLabel("New Image");
btn.setStyle("PRIMARY");
row.addComponents(btn);
axios("https://api.thecatapi.com/v1/images/search").then((res) => {
int.reply({embeds: [{title: "Meow", image: {url: res.data[0].url}, color: "#ec76fd"}]});
int.reply({embeds: [{title: "Meow", image: {url: res.data[0].url}, color: "#ec76fd"}], components: [row]});
});
} else if(int.commandName == "fox"){
const row = new dc.MessageActionRow();
const btn = new dc.MessageButton();
btn.setCustomId("fox-" + Math.round(Math.random()*99999));
btn.setLabel("New Image");
btn.setStyle("PRIMARY");
row.addComponents(btn);
axios("https://randomfox.ca/floof/").then(res => {
int.reply({embeds: [{title: "uwu", image: {url: res.data.image}, color: "#ffa500"}]});
int.reply({embeds: [{title: "uwu", image: {url: res.data.image}, color: "#ffa500"}], components: [row]});
});
} else if(int.commandName == "apis"){
var apis = {
@ -219,5 +231,27 @@ client.on("interactionCreate", (int) => {
});
int.reply("Here are all the APIs used in the bot: \n" + apiArray.join("\n"));
}
} else if(int.isButton()){
if(int.customId.startsWith("cat")){
const row = new dc.MessageActionRow();
const btn = new dc.MessageButton();
btn.setCustomId("cat-" + Math.round(Math.random()*99999));
btn.setLabel("New Image");
btn.setStyle("PRIMARY");
row.addComponents(btn);
axios("https://api.thecatapi.com/v1/images/search").then((res) => {
int.message.edit({embeds: [{title: "Meow", image: {url: res.data[0].url}, color: "#ec76fd"}], components: [row]});
});
} else if(int.customId.startsWith("fox")){
const row = new dc.MessageActionRow();
const btn = new dc.MessageButton();
btn.setCustomId("fox-" + Math.round(Math.random()*99999));
btn.setLabel("New Image");
btn.setStyle("PRIMARY");
row.addComponents(btn);
axios("https://randomfox.ca/floof/").then(res => {
int.message.edit({embeds: [{title: "uwu", image: {url: res.data.image}, color: "#ffa500"}], components: [row]});
});
}
}
});