Skip to content
Snippets Groups Projects
Commit 588b1def authored by psy's avatar psy
Browse files

accept dm invite, only respond to !help in dms

parent 05ae0d18
Branches main
No related tags found
No related merge requests found
......@@ -63,13 +63,19 @@ class RssBot:
if config:
self._handle_room_config(room, config)
def _handle_invite(self, roomId, state):
# check if local room
if not roomId.endswith(self.client.user_id.split(':')[1]):
print('Ignoring invitation to', roomId)
def _handle_invite(self, room_id, state):
# check if local room or DM
is_dm = False
for event in state['events']:
if event['content'].get('is_direct', False):
is_dm = True
break
if not (room_id.endswith(self.client.user_id.split(':')[1]) or is_dm):
print('Ignoring invitation to', room_id)
return
room = self.client.join_room(roomId)
room = self.client.join_room(room_id)
self._setup_room(room)
def _handle_leave(self, room_id, room):
......@@ -78,8 +84,9 @@ class RssBot:
self._update_feeds_config()
def _handle_message(self, room, event):
# check for room name to only reply in DMs (room.name == None => DM)
msg = str(event['content']['body'])
if msg.startswith('!help'):
if msg.startswith('!help') and room.name is None:
help_message = """I'm here to keep you updated on rss feeds!<br><br>
Invite me to any room on {homeserver} and use the custom state event <code>de.eventscccde.rssbot</code> via
<code>/devtools</code> to set the rss feeds:<br>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment