diff --git a/brutal/core/bot.py b/brutal/core/bot.py index 73f3e23..911dbf2 100644 --- a/brutal/core/bot.py +++ b/brutal/core/bot.py @@ -12,7 +12,7 @@ class Bot(object): - def __init__(self, nick, connections, *args, **kwargs): + def __init__(self, nick, connections, command_token='!', *args, **kwargs): """ acts as a connection manager, middle man for incoming events, and processor of outgoing actions. """ @@ -22,6 +22,7 @@ def __init__(self, nick, connections, *args, **kwargs): # bot id self.nick = nick self.id = str(uuid.uuid1()) + self.command_token = command_token self.log = logging.getLogger('{0}.{1}.{2}'.format(self.__class__.__module__, self.__class__.__name__, self.nick)) self.log.info('starting bot') diff --git a/brutal/core/models.py b/brutal/core/models.py index c6085de..5ae188b 100644 --- a/brutal/core/models.py +++ b/brutal/core/models.py @@ -130,7 +130,7 @@ def parse_details(self): self.from_bot = False if self.event_type == 'message' and isinstance(self.meta, dict) and 'body' in self.meta: - res = self.parse_event_cmd(self.meta['body']) + res = self.parse_event_cmd(self.meta['body'], self.source_bot.command_token) # if res is False: # self.log.debug('event not parsed as a command') @@ -290,4 +290,4 @@ def part(self, channel, msg=None): self.type = 'part' if msg is not None: self._add_to_meta('msg', msg) - return self \ No newline at end of file + return self diff --git a/brutal/spawn/spawn_template/spawn_name/config.py b/brutal/spawn/spawn_template/spawn_name/config.py index f56d170..7ff7af8 100644 --- a/brutal/spawn/spawn_template/spawn_name/config.py +++ b/brutal/spawn/spawn_template/spawn_name/config.py @@ -48,6 +48,7 @@ # 'channels': ['room', ('private_room', 'pass')] # } # ], - # 'plugin_settings': {} + # 'plugin_settings': {}, + # 'command_token': '.' # } -] \ No newline at end of file +]