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

General Question #457

Open
inglesuniversal opened this issue Mar 22, 2023 · 2 comments
Open

General Question #457

inglesuniversal opened this issue Mar 22, 2023 · 2 comments

Comments

@inglesuniversal
Copy link

How to force annyang.trigger('command') to work, even if NOT in listening mode or Speech API is not available on browser.

Thanks

@daemonX10
Copy link

const userInput = "your user input here"; // Get the user's input
const commandKeywords = ["keyword1", "keyword2", "keyword3"];

// Check if any of the keywords are present in the user's input
for (const keyword of commandKeywords) {
if (userInput.includes(keyword)) {
// Perform the action associated with the matched keyword
// This can be a function call or any other action
console.log(Matched keyword: ${keyword});
break; // Stop checking once a match is found
}
}

@inglesuniversal
Copy link
Author

Thanks will try it out!

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