mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
adds incognito mode, fixes /emoji
This commit is contained in:
parent
fbdf212151
commit
e61a604b7c
36 changed files with 401 additions and 127 deletions
|
@ -1,11 +1,13 @@
|
|||
const { AudioTranscribe } = require('#obelisk');
|
||||
|
||||
const { createEmbed } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { editOrReply } = require('#utils/message');
|
||||
const { codeblock } = require('#utils/markdown');
|
||||
const { STATICS } = require('#utils/statics');
|
||||
|
||||
const { InteractionCallbackTypes, ApplicationCommandTypes, MessageFlags } = require("detritus-client/lib/constants");;
|
||||
const { ApplicationCommandTypes, MessageFlags } = require("detritus-client/lib/constants");
|
||||
;
|
||||
|
||||
module.exports = {
|
||||
name: 'Transcribe Voice Message',
|
||||
|
@ -19,38 +21,38 @@ module.exports = {
|
|||
1
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: { flags: MessageFlags.EPHEMERAL }, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context);
|
||||
|
||||
try {
|
||||
const { message } = args;
|
||||
try {
|
||||
const { message } = args;
|
||||
|
||||
if(!message.attachments.first()) return editOrReply(context, {
|
||||
embeds: [createEmbed("warning", context, "No voice message found.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
if(!message.attachments.first().url.split('?')[0].endsWith('voice-message.ogg')) return editOrReply(context, {
|
||||
embeds: [createEmbed("warning", context, "No voice message found.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
||||
const recog = await AudioTranscribe(context, message.attachments.first().url)
|
||||
|
||||
return editOrReply(context, {
|
||||
embeds: [createEmbed("default", context, {
|
||||
description: codeblock("md", [ recog.response.body.transcript.substr(0,3900) ]),
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Speech to Text • ${context.application.name}`
|
||||
}
|
||||
})],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
return editOrReply(context, {
|
||||
embeds: [createEmbed("error", context, "Unable to transcribe message.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
}
|
||||
if (!message.attachments.first()) return editOrReply(context, {
|
||||
embeds: [createEmbed("warning", context, "No voice message found.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
if (!message.attachments.first().url.split('?')[0].endsWith('voice-message.ogg')) return editOrReply(context, {
|
||||
embeds: [createEmbed("warning", context, "No voice message found.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
||||
const recog = await AudioTranscribe(context, message.attachments.first().url)
|
||||
|
||||
return editOrReply(context, {
|
||||
embeds: [createEmbed("default", context, {
|
||||
description: codeblock("md", [recog.response.body.transcript.substr(0, 3900)]),
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Speech to Text • ${context.application.name}`
|
||||
}
|
||||
})],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
||||
} catch (e) {
|
||||
return editOrReply(context, {
|
||||
embeds: [createEmbed("error", context, "Unable to transcribe message.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue