config: use a generic error message for issues

master
dece 4 years ago
parent 93288d3599
commit 828802fdbe

@ -6,6 +6,7 @@
"channels": ["#idi0crates"], "channels": ["#idi0crates"],
"speak_delay": 0.5, "speak_delay": 0.5,
"resources_dir": "resources", "resources_dir": "resources",
"error_message": "An error occured, sorry!",
"plugins": { "plugins": {
"beers": { "beers": {
"commands": ["beer"], "commands": ["beer"],
@ -41,7 +42,6 @@
"lang": "en", "lang": "en",
"ambiguous_response": "It is ambiguous.", "ambiguous_response": "It is ambiguous.",
"empty_response": "I can't find it.", "empty_response": "I can't find it.",
"error_response": "An error occured ;("
} }
} }
} }

@ -12,8 +12,7 @@ from edmond.plugin import Plugin
class WikipediaPlugin(Plugin): class WikipediaPlugin(Plugin):
REQUIRED_CONFIGS = [ REQUIRED_CONFIGS = [
"commands", "ambiguous_response", "empty_response", "error_response", "commands", "ambiguous_response", "empty_response", "lang",
"lang",
] ]
NUM_RETRIES = 3 NUM_RETRIES = 3
@ -59,7 +58,7 @@ class WikipediaPlugin(Plugin):
summary = self.config["empty_response"] summary = self.config["empty_response"]
break break
except wikipedia.exceptions.WikipediaException: except wikipedia.exceptions.WikipediaException:
summary = self.config["error_response"] summary = self.bot.config["error_message"]
# Keep trying after a slight delay. # Keep trying after a slight delay.
time.sleep(1) time.sleep(1)
retries -= 1 retries -= 1

Loading…
Cancel
Save