Open soundstorm opened 4 years ago
But maybe a PR at rocket-python
would be necessary too, to get this working well. Iterating over a list of channels is not the best option but was the fastest to implement when using this particular library which doesn't offer better methods.
Posting of images needs investigation too.
Okay, posting of images was my fault, as the bot
user role in my RC hadn't the permission post-readonly
(couldn't upload files but post messages, uuuhm?)
We may wait for https://github.com/Pipoline/rocket-python/pull/49 as the code would be much better then:
rc_room_id = None
if channel[0] == "#":
rc_room_id = rc.get_public_room_id(channel[1:])
elif channel[0] == "@":
rc_self = rc.get_my_info()
# generate room id by concatenating the user ids
rc_room_id = rc.get_user_id(channel[1:]) + rc_self['_id']
else: # backwards compatibility with no # or @ to post to groups
rc_room_id = rc.get_room_id(channel) #groups
By using
#channel
or@user
in channel list it's possible to post to channels or (only already contacted) users. Limited to first 50 visible channels, as paging does not work withRocketChatAPI
. Somehow posting images to RC does not work.Closes #92