Skip to content

Commit

Permalink
fix: register script aliases in all langs, not only in main one (#17)
Browse files Browse the repository at this point in the history
* fix: register script aliases in all langs, not only in main one

in the future these should also be made translatable, but for now they should depend on the query language

* add sound feedback

* .
  • Loading branch information
JarbasAl authored Nov 17, 2024
1 parent e63b75f commit 63e2e02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ def initialize(self):

for alias in self.alias:
LOG.info(f"Adding script keyword: {alias}")
self.register_vocabulary(alias, 'Script')
for lang in self.native_langs:
self.register_vocabulary(alias, 'Script', lang=lang)

@intent_handler(IntentBuilder('RunScriptCommandIntent')
.require('Script').require('Run'))
def run(self, message):
self.acknowledge()
script = message.data.get('Script')
script = self.alias.get(script, script)
shell = self.settings.get('shell', True)
Expand All @@ -63,3 +65,4 @@ def run(self, message):
subprocess.Popen(args, shell=shell)
except Exception:
LOG.exception('Could not run script ' + script)
self.play_audio("snd/error.mp3", instant=True)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ovos-workshop>=0.0.15,<2.0.0
ovos-workshop>=0.0.15,<3.0.0

0 comments on commit 63e2e02

Please sign in to comment.