no more crash

This commit is contained in:
imbwbl 2024-01-18 23:31:10 +01:00
parent 4648001dcf
commit 534ec6e54e
2 changed files with 20 additions and 8 deletions

View File

@ -3,7 +3,9 @@ import { SlashCommandBuilder} from "discord.js";
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName('femboy') .setName('femboy')
.setDescription('femboy penis porno') .setDescription('femboy penis porno')
export async function execute(interaction, defer=false) { export async function execute(interaction, defer=false, maxTry=10) {
maxTry--
if (maxTry === 0) return
if (!defer) await interaction.deferReply() if (!defer) await interaction.deferReply()
if (interaction.channel.nsfw) { if (interaction.channel.nsfw) {
@ -29,14 +31,16 @@ export async function execute(interaction, defer=false) {
.then(response => response.json()) .then(response => response.json())
.then(response => { .then(response => {
let i = Math.floor(Math.random() * response.length) let i = Math.floor(Math.random() * response.length)
let ip = Math.floor(Math.random() * response[i].attachments.length) if (response.length === 0 || response[i].attachments.length === 0) {
if (!response.attachments || response.length === 0 || response[i].attachments.length === 0) {
return null return null
} }
let ip = Math.floor(Math.random() * response[i].attachments.length)
return "https://coomer.su" + response[i].attachments[ip].path return "https://coomer.su" + response[i].attachments[ip].path
}).catch(e => {
console.log(e)
}) })
if (!getLink) { if (!getLink) {
return execute(interaction, true) return execute(interaction, true, maxTry)
} }
await fetch(getLink, options) await fetch(getLink, options)
@ -48,6 +52,8 @@ export async function execute(interaction, defer=false) {
name: 'image.png' name: 'image.png'
}] }]
}); });
}).catch(e => {
console.log(e)
}) })
} else { } else {
interaction.reply({ interaction.reply({

View File

@ -3,7 +3,9 @@ import { SlashCommandBuilder} from "discord.js";
export const data = new SlashCommandBuilder() export const data = new SlashCommandBuilder()
.setName('porn') .setName('porn')
.setDescription('reel women prono') .setDescription('reel women prono')
export async function execute(interaction, defer=false) { export async function execute(interaction, defer=false, maxTry=10) {
maxTry--
if (maxTry === 0) return
if (!defer) await interaction.deferReply() if (!defer) await interaction.deferReply()
if (interaction.channel.nsfw) { if (interaction.channel.nsfw) {
@ -45,14 +47,16 @@ export async function execute(interaction, defer=false) {
.then(response => response.json()) .then(response => response.json())
.then(response => { .then(response => {
let i = Math.floor(Math.random() * response.length) let i = Math.floor(Math.random() * response.length)
let ip = Math.floor(Math.random() * response[i].attachments.length) if (response.length === 0 || response[i].attachments.length === 0) {
if (!response.attachments || response.length === 0 || response[i].attachments.length === 0) {
return null return null
} }
let ip = Math.floor(Math.random() * response[i].attachments.length)
return "https://coomer.su" + response[i].attachments[ip].path return "https://coomer.su" + response[i].attachments[ip].path
}).catch(e => {
console.log(e)
}) })
if (!getLink) { if (!getLink) {
return execute(interaction, true) return execute(interaction, true, maxTry)
} }
await fetch(getLink, options) await fetch(getLink, options)
@ -64,6 +68,8 @@ export async function execute(interaction, defer=false) {
name: 'image.png' name: 'image.png'
}] }]
}); });
}).catch(e => {
console.log(e)
}) })
} else { } else {
interaction.reply({ interaction.reply({