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

Is there going to be a v13 version soon? #4

Open
EBMOfficial opened this issue Feb 20, 2022 · 7 comments
Open

Is there going to be a v13 version soon? #4

EBMOfficial opened this issue Feb 20, 2022 · 7 comments

Comments

@EBMOfficial
Copy link

No description provided.

@ShadowLp174
Copy link

I'm not sure if this repository is still active, but if need the transcriber for v13, then have a look at this. I'll be publishing a music bot with voice commands soon :)

@ShadowLp174
Copy link

ShadowLp174 commented Mar 18, 2022

You can then use something like this to parse the commands:

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

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

It will give you a well-formated command or false (if not valid) for further processing. ("play ...", "pause ...", "resume ....", ...)

@ShadowLp174
Copy link

All-in-all you can do something like this:

connection.receiver.speaking.on("start", (userId) => {
    const user = client.users.cache.get(userId);
    console.log("Listening to " + user.username);
    transcriber.listen(connection.receiver, userId, user).then((data) => {
      if (!data.transcript.text) return;
      let parsed = parse(data.transcript.text, ["play", "pause", "resume", "skip", "shuffle", "list"]);
      if (!parsed) {return;}
      
      // do whatever you want with the parsed command
      executeVoiceCommand(parsed);
    });
 });

Where you have to put this snippet, is declared in the Transcriber repository

Happy coding :D

@EBMOfficial
Copy link
Author

You are an amazing individual. Thank you, and make sure to have a fantastic day!

@ShadowLp174
Copy link

I'm glad I could help :)

@ShadowLp174
Copy link

I published the discord bot. Feel free to test it :)
https://github.com/ShadowLp174/stt-example-bot

@EBMOfficial
Copy link
Author

I'll test it out when I get free soon! Thank you so much!!

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

2 participants