tts
This commit is contained in:
parent
704ff9fc2a
commit
a58eb676bd
4 changed files with 49 additions and 62 deletions
|
@ -59,17 +59,6 @@ export class UserCommand extends Command {
|
|||
// get an array buffer
|
||||
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[] = [];
|
||||
|
||||
imageAttachment.push(
|
||||
|
@ -89,7 +78,6 @@ export class UserCommand extends Command {
|
|||
content,
|
||||
files: imageAttachment
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;
|
||||
|
||||
|
|
|
@ -59,17 +59,6 @@ export class UserCommand extends Command {
|
|||
// get an array buffer
|
||||
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[] = [];
|
||||
|
||||
imageAttachment.push(
|
||||
|
@ -89,7 +78,6 @@ export class UserCommand extends Command {
|
|||
content,
|
||||
files: imageAttachment
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ApplyOptions } from '@sapphire/decorators';
|
||||
import { Args, BucketScope, Command } from '@sapphire/framework';
|
||||
import { AttachmentBuilder, Message } from 'discord.js';
|
||||
import { AttachmentBuilder, Message, MessageFlags } from 'discord.js';
|
||||
import OpenAI from 'openai';
|
||||
|
||||
const openai = new OpenAI({
|
||||
|
@ -64,21 +64,32 @@ export class UserCommand extends Command {
|
|||
const content = `Prompt: ${prompt}:`;
|
||||
|
||||
if (interactionOrMessage instanceof Message) {
|
||||
return askMessage.edit({ content, files: mp3Attachment });
|
||||
return askMessage.edit({
|
||||
content,
|
||||
files: mp3Attachment,
|
||||
flags: '8192'
|
||||
});
|
||||
}
|
||||
|
||||
return interactionOrMessage.editReply({
|
||||
content,
|
||||
files: mp3Attachment
|
||||
files: mp3Attachment,
|
||||
options: {
|
||||
flags: MessageFlags.IsVoiceMessage.valueOf()
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
const content = "Sorry, I can't complete the prompt for: " + prompt + '\n' + error;
|
||||
|
||||
if (interactionOrMessage instanceof Message) {
|
||||
return askMessage.edit({ content });
|
||||
return askMessage.edit({
|
||||
content
|
||||
});
|
||||
}
|
||||
|
||||
return interactionOrMessage.editReply({ content });
|
||||
return interactionOrMessage.editReply({
|
||||
content
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ const client = new SapphireClient({
|
|||
status: 'online',
|
||||
activities: [
|
||||
{
|
||||
name: 'BOAT PARADE! BOAT PARADE! BOAT PARADE!',
|
||||
type: ActivityType.Listening
|
||||
name: 'idk',
|
||||
type: ActivityType.Custom
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ const client = new SapphireClient({
|
|||
defaultCooldown: {
|
||||
// 10s
|
||||
delay: 10_000,
|
||||
filteredCommands: ['disclosure', 'support', 'ping', 'wryna'],
|
||||
filteredCommands: ['support', 'ping', 'wryna'],
|
||||
limit: 2,
|
||||
// Yes... I did hardcode myself.
|
||||
filteredUsers: ['83679718401904640'],
|
||||
|
|
Loading…
Add table
Reference in a new issue