Browse Source

start and stop commands

master
Hendrik Langer 2 years ago
parent
commit
9ddd39daa2
  1. 9
      matrix_pygmalion_bot/core.py

9
matrix_pygmalion_bot/core.py

@ -67,6 +67,9 @@ class Callbacks(object):
)
await self.client.room_read_markers(room.room_id, event.event_id, event.event_id)
# Ignore messages when disabled
if "disabled" in self.bot.room_config[room.room_id] and self.bot.room_config[room.room_id]["disabled"] == True and not event.body.startswith('!start'):
return
# Ignore messages from ourselves
if chat_message.is_own_message:
return
@ -103,6 +106,12 @@ class Callbacks(object):
await self.bot.write_conf2(self.bot.name)
await self.bot.send_message(self.client, room.room_id, self.bot.greeting)
return
elif event.body.startswith('!start'):
self.bot.room_config[room.room_id]["disabled"] = False
return
elif event.body.startswith('!stop'):
self.bot.room_config[room.room_id]["disabled"] = True
return
elif event.body.startswith('!!!'):
if self.bot.chat_history.room(room.display_name).getLen() < 3:
return

Loading…
Cancel
Save