Browse Source

adding comments to the different sections of the code

master
manetta 4 years ago
parent
commit
61f5d546ec
  1. 6
      LogBot/logbot.py

6
LogBot/logbot.py

@ -172,7 +172,7 @@ class Logbot(Bot):
self.log.info(f"sender: { message.sender }")
self.log.info("------------------")
# image / PDF / audio / video
# Response to files: image / PDF / audio / video
if message.url:
media_post, media_type = self._download(message)
if media_post:
@ -182,10 +182,12 @@ class Logbot(Bot):
else:
reply = "Sorry, can't process that :( (unknown media type?)"
# Response to @add
elif "@add" in message.text:
self._add_to_db(message)
reply = "Added, thanks!"
# Response to @delete
elif "@delete" in message.text:
match = re.findall(r"@delete \d*", message.content)[0]
key = str(match.replace("@delete ", ""))
@ -199,12 +201,14 @@ class Logbot(Bot):
else:
reply = "This message is already gone!"
# Response to @title
elif "@title" in message.text:
match = re.findall("@title .*", message.content)[0]
title = match.replace("@title", "")
self.db[message.room]["title"] = title
reply = f"The title of the log is changed to: { title }"
# Response to @style
elif "@style" in message.text:
reply = "This is a future-feature ..."

Loading…
Cancel
Save