Skip to content

Commit

Permalink
blacklist default skill
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Dec 5, 2020
1 parent bab01db commit 866ab90
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Query [Wikipedia](https://www.wikipedia.org) for answers to all your questions.

This Skill uses the [Wikipedia for humans](https://github.com/HelloChatterbox/wikipedia_for_humans).

NOTE: this will blacklist the official mycroft skill

## Examples
* "Tell me about Elon Musk"
Expand Down
20 changes: 20 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from adapt.intent import IntentBuilder
from mycroft.skills.core import (MycroftSkill, intent_handler,
intent_file_handler)
from mycroft.messagebus.message import Message
from mycroft.configuration import LocalConf, USER_CONFIG,Configuration


class WikipediaSkill(MycroftSkill):
Expand All @@ -22,6 +24,24 @@ def __init__(self):
self.idx = 0
self.results = []

def initialize(self):
self.blacklist_default_skill()

def blacklist_default_skill(self):
core_conf = Configuration.load_config_stack()
blacklist = core_conf["skills"]["blacklisted_skills"]
if "mycroft-wiki.mycroftai" not in blacklist:
self.log.debug("Blacklisting official mycroft wikipedia skill")
blacklist.append("mycroft-wiki.mycroftai")
conf = LocalConf(USER_CONFIG)
if "skills" not in conf:
conf["skills"] = {}
conf["skills"]["blacklisted_skills"] = blacklist
conf.store()

self.bus.emit(Message("detach_skill",
{"skill_id": "mycroft-wiki.mycroftai"}))

def speak_result(self):
if self.idx + 1 > len(self.results):
self.speak_dialog("thats all")
Expand Down

0 comments on commit 866ab90

Please sign in to comment.