Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined #1

Open
AikoTR opened this issue Jun 15, 2022 · 4 comments
Open

TypeError: Cannot read properties of undefined #1

AikoTR opened this issue Jun 15, 2022 · 4 comments

Comments

@AikoTR
Copy link

AikoTR commented Jun 15, 2022

Transcriber-error: TypeError: Cannot read properties of undefined (reading 'replace')
at Transcriber.transcribe (C:\Users\aikof\Documents\Dev\DiscordBotTestVoice\node_modules\discord-speech-to-text\transcriber.js:59:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Decoder. (C:\Users\aikof\Documents\Dev\DiscordBotTestVoice\node_modules\discord-speech-to-text\transcriber.js:88:28)

@ShadowLp174 ShadowLp174 added the bug Something isn't working label Jun 15, 2022
@ShadowLp174
Copy link
Owner

Hhhm...

I'll have a look at that soon:tm:

May I ask what exactly you did - This would make things a lot easier :) (code would be very useful)

@ShadowLp174 ShadowLp174 removed the bug Something isn't working label Jun 18, 2022
@EBMOfficial
Copy link

EBMOfficial commented Jun 24, 2022

I'm having this issue too. The code that AikoTR is very likely referring to is the code for the parse function.

`function parse(string, possible) {
let output = string.repeat(1);
string = string.replace("/./g", "");
string = string.toLowerCase().replace("computer", "").trim();
if (string.includes(" ")) string = string.split(" ")[0];
string = string.trim();
if (!possible.includes(string)) return false;
output = output.replace(/./g, "").toLowerCase().replace("computer", "").trim();
return output;
}

// Usage:
let command = parse(TranscribedText, ["play", "pause", "resume", "skip", "shuffle", "list"]);`

@ShadowLp174
Copy link
Owner

Hhm

Sometimes there is an error with wit or similar, I can't change... In this cases, the transcript.text property will be undefined... That could be the problem here but I'm not sure.

I'll look into it tomorrow but if you want to try fixing it, add the following line before the parse function:

if (!TranscribedText) return;

@ShadowLp174
Copy link
Owner

Hhm

Sometimes there is an error with wit or similar, I can't change... In this cases, the transcript.text property will be undefined... That could be the problem here but I'm not sure.

I'll look into it tomorrow but if you want to try fixing it, add the following line before the parse function:

if (!TranscribedText) return;

If there is a Transcriber error before the problem in the logs, please tell me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants