From aa61bb16c9d5404bf957be1b2408071c8e1ea8cb Mon Sep 17 00:00:00 2001 From: Vaelor Date: Mon, 27 Nov 2017 10:53:23 +0100 Subject: [PATCH] Fix not having a channelid to join a room #33 --- mattermost.plug | 2 +- src/mattermostRoom.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mattermost.plug b/mattermost.plug index 211b863..ce87144 100644 --- a/mattermost.plug +++ b/mattermost.plug @@ -5,5 +5,5 @@ Module = mattermost [Documentation] Description = A Mattermost backend for errbot. Author = Christian Plümer -Version = 2.0.1 +Version = 2.0.2 Website = https://github.com/Vaelor/errbot-mattermost-backend diff --git a/src/mattermostRoom.py b/src/mattermostRoom.py index 5600094..59e2f90 100644 --- a/src/mattermostRoom.py +++ b/src/mattermostRoom.py @@ -23,6 +23,12 @@ def __init__(self, name=None, channelid=None, teamid=None, bot=None): self._teamid = teamid self._id = None if channelid is None else channelid + if self._id is None and name is not None: + try: + self._id = bot.channelname_to_channelid(name) + except RoomDoesNotExistError as e: + # If the room does not exist, maybe it will be created. + log.info(e) self._bot = bot self.driver = bot.driver