thje
This commit is contained in:
parent
e16f5ecd5c
commit
5d13801f15
2 changed files with 11 additions and 17 deletions
|
@ -110,7 +110,7 @@ module.exports = {
|
||||||
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
||||||
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
||||||
|
|
||||||
await interaction.reply("Searching, please wait...");
|
await interaction.reply("<:search:1293874677915320330> Searching, please wait...");
|
||||||
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags];
|
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags];
|
||||||
|
|
||||||
const startTime = process.hrtime.bigint();
|
const startTime = process.hrtime.bigint();
|
||||||
|
@ -119,7 +119,7 @@ module.exports = {
|
||||||
while (post == null) {
|
while (post == null) {
|
||||||
var newPost = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];
|
var newPost = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];
|
||||||
if (newPost == null) {
|
if (newPost == null) {
|
||||||
await interaction.editReply("Could not find any post matching tags.");
|
await interaction.editReply("<:warning:1293874152150667315> Could not find any post matching tags.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
||||||
|
@ -154,26 +154,13 @@ module.exports = {
|
||||||
.setTitle(`Post #${post.id}`)
|
.setTitle(`Post #${post.id}`)
|
||||||
.setURL(post.postView)
|
.setURL(post.postView)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
/* .setFields([{
|
|
||||||
name: "Score",
|
|
||||||
value: formatScore(post.score),
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: "Rating",
|
|
||||||
value: formatRating(post.rating),
|
|
||||||
inline: true
|
|
||||||
}, {
|
|
||||||
name: "Tags",
|
|
||||||
value: formatTags(post.tags),
|
|
||||||
inline: false
|
|
||||||
}])*/
|
|
||||||
.setImage(post.fileUrl)
|
.setImage(post.fileUrl)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: footerText,
|
text: footerText,
|
||||||
iconURL: `https://${post.booru.domain}/favicon.ico`,
|
iconURL: `https://${post.booru.domain}/favicon.ico`,
|
||||||
})
|
})
|
||||||
|
|
||||||
await interaction.editReply({ embeds: [embed.data] });
|
await interaction.editReply({ content: "", embeds: [embed.data] });
|
||||||
} else {
|
} else {
|
||||||
await interaction.editReply(
|
await interaction.editReply(
|
||||||
'>>> ' + bold(`[Post #${post.id}](<${post.postView}>)`) + "\n" +
|
'>>> ' + bold(`[Post #${post.id}](<${post.postView}>)`) + "\n" +
|
||||||
|
|
|
@ -40,6 +40,13 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var options = "";
|
||||||
|
for (const option of interaction.options.data) {
|
||||||
|
options += option.name + ":" + option.value
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`${interaction.user.username} ran /${interaction.commandName} ${options}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
interaction.defaultModel = "llama-3.1-70b-versatile";
|
interaction.defaultModel = "llama-3.1-70b-versatile";
|
||||||
await command.execute(interaction);
|
await command.execute(interaction);
|
||||||
|
@ -57,7 +64,7 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.once(Events.ClientReady, async() => {
|
client.once(Events.ClientReady, async () => {
|
||||||
console.log(`Ready! Logged in as ${client.user.displayName}`);
|
console.log(`Ready! Logged in as ${client.user.displayName}`);
|
||||||
|
|
||||||
var user = client.user.toJSON();
|
var user = client.user.toJSON();
|
||||||
|
|
Loading…
Reference in a new issue