Skip to content

Commit aa61bb1

Browse files
committed
Fix not having a channelid to join a room
#33
1 parent 2c44afd commit aa61bb1

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

mattermost.plug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Module = mattermost
55
[Documentation]
66
Description = A Mattermost backend for errbot.
77
Author = Christian Plümer
8-
Version = 2.0.1
8+
Version = 2.0.2
99
Website = https://github.com/Vaelor/errbot-mattermost-backend

src/mattermostRoom.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def __init__(self, name=None, channelid=None, teamid=None, bot=None):
2323

2424
self._teamid = teamid
2525
self._id = None if channelid is None else channelid
26+
if self._id is None and name is not None:
27+
try:
28+
self._id = bot.channelname_to_channelid(name)
29+
except RoomDoesNotExistError as e:
30+
# If the room does not exist, maybe it will be created.
31+
log.info(e)
2632
self._bot = bot
2733
self.driver = bot.driver
2834

0 commit comments

Comments
 (0)