diff --git a/README.md b/README.md index 8c679d5..b030cba 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,5 @@ using [HTTP API](https://gitea.brno.mraveniste.cc/turbotraktor/ladylilia.com/src - `PATTERN` has to be at least 3 characters long and it can be enclosed in double quotes in case it contains spaces * `!syncquotes` - performs synchronization of the quotes database with Twitch VODs - only master user is allowed to use this command +* `!reload` - reloads the list of extra commands from the config file + - only master user is allowed to use this command diff --git a/clients/twitch.py b/clients/twitch.py index eba7b44..7f12fae 100644 --- a/clients/twitch.py +++ b/clients/twitch.py @@ -49,6 +49,7 @@ class TwitchClient(irc.bot.SingleServerIRCBot): (re.compile(r'^!(bella(gram|pics)|insta(gram|bella))$'), self._do_bellagram), (re.compile(r'^!yt\s+(?P")?(?P.+)(?(q)")$'), self._do_yt), (re.compile(r'^!clip\s+(?P")?(?P.+)(?(q)")$'), self._do_clip), + (re.compile(r'^!reload$'), self._do_reload), ] server = self.config['IRC'].get('server') port = self.config['IRC'].getint('port') @@ -186,3 +187,11 @@ class TwitchClient(irc.bot.SingleServerIRCBot): send_response('Sorry @{0}, {1}'.format(tags['display-name'], e)) else: send_response('{0}: {1}'.format(result['title'], result['url'])) + + def _do_reload(self, tags, send_response, **kwargs): + master_user_id = self.config['Twitch'].getint('master_user_id') + if int(tags['user-id']) != master_user_id: + respond('Sorry @{0}, you are not allowed to do this'.format(tags['display-name'])) + return + self.config.remove_section('Extra Commands') + self.config.read('settings.cfg')