This commit is contained in:
Atridad Lahiji 2023-11-10 23:52:39 -07:00
parent 704ff9fc2a
commit a58eb676bd
No known key found for this signature in database
4 changed files with 49 additions and 62 deletions

View file

@ -59,17 +59,6 @@ export class UserCommand extends Command {
// get an array buffer // get an array buffer
const imageBuffer = await fetch(imageUrl).then((r) => r.arrayBuffer()); const imageBuffer = await fetch(imageUrl).then((r) => r.arrayBuffer());
if (response.data.length === 0) {
const content = `Sorry, I can't complete the prompt for: ${prompt}`;
if (interactionOrMessage instanceof Message) {
return askMessage.edit({ content });
}
return interactionOrMessage.editReply({
content: content
});
} else {
const imageAttachment: AttachmentBuilder[] = []; const imageAttachment: AttachmentBuilder[] = [];
imageAttachment.push( imageAttachment.push(
@ -89,7 +78,6 @@ export class UserCommand extends Command {
content, content,
files: imageAttachment files: imageAttachment
}); });
}
} catch (error) { } catch (error) {
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error; const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;

View file

@ -59,17 +59,6 @@ export class UserCommand extends Command {
// get an array buffer // get an array buffer
const imageBuffer = await fetch(imageUrl).then((r) => r.arrayBuffer()); const imageBuffer = await fetch(imageUrl).then((r) => r.arrayBuffer());
if (response.data.length === 0) {
const content = `Sorry, I can't complete the prompt for: ${prompt}`;
if (interactionOrMessage instanceof Message) {
return askMessage.edit({ content });
}
return interactionOrMessage.editReply({
content: content
});
} else {
const imageAttachment: AttachmentBuilder[] = []; const imageAttachment: AttachmentBuilder[] = [];
imageAttachment.push( imageAttachment.push(
@ -89,7 +78,6 @@ export class UserCommand extends Command {
content, content,
files: imageAttachment files: imageAttachment
}); });
}
} catch (error) { } catch (error) {
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error; const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;

View file

@ -1,6 +1,6 @@
import { ApplyOptions } from '@sapphire/decorators'; import { ApplyOptions } from '@sapphire/decorators';
import { Args, BucketScope, Command } from '@sapphire/framework'; import { Args, BucketScope, Command } from '@sapphire/framework';
import { AttachmentBuilder, Message } from 'discord.js'; import { AttachmentBuilder, Message, MessageFlags } from 'discord.js';
import OpenAI from 'openai'; import OpenAI from 'openai';
const openai = new OpenAI({ const openai = new OpenAI({
@ -64,21 +64,32 @@ export class UserCommand extends Command {
const content = `Prompt: ${prompt}:`; const content = `Prompt: ${prompt}:`;
if (interactionOrMessage instanceof Message) { if (interactionOrMessage instanceof Message) {
return askMessage.edit({ content, files: mp3Attachment }); return askMessage.edit({
content,
files: mp3Attachment,
flags: '8192'
});
} }
return interactionOrMessage.editReply({ return interactionOrMessage.editReply({
content, content,
files: mp3Attachment files: mp3Attachment,
options: {
flags: MessageFlags.IsVoiceMessage.valueOf()
}
}); });
} catch (error) { } catch (error) {
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error; const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;
if (interactionOrMessage instanceof Message) { if (interactionOrMessage instanceof Message) {
return askMessage.edit({ content }); return askMessage.edit({
content
});
} }
return interactionOrMessage.editReply({ content }); return interactionOrMessage.editReply({
content
});
} }
} }
} }

View file

@ -8,8 +8,8 @@ const client = new SapphireClient({
status: 'online', status: 'online',
activities: [ activities: [
{ {
name: 'BOAT PARADE! BOAT PARADE! BOAT PARADE!', name: 'idk',
type: ActivityType.Listening type: ActivityType.Custom
} }
] ]
}, },
@ -22,7 +22,7 @@ const client = new SapphireClient({
defaultCooldown: { defaultCooldown: {
// 10s // 10s
delay: 10_000, delay: 10_000,
filteredCommands: ['disclosure', 'support', 'ping', 'wryna'], filteredCommands: ['support', 'ping', 'wryna'],
limit: 2, limit: 2,
// Yes... I did hardcode myself. // Yes... I did hardcode myself.
filteredUsers: ['83679718401904640'], filteredUsers: ['83679718401904640'],