forked from varia/bots
adding comments to the different sections of the code
This commit is contained in:
parent
52cab957cb
commit
61f5d546ec
@ -172,7 +172,7 @@ class Logbot(Bot):
|
|||||||
self.log.info(f"sender: { message.sender }")
|
self.log.info(f"sender: { message.sender }")
|
||||||
self.log.info("------------------")
|
self.log.info("------------------")
|
||||||
|
|
||||||
# image / PDF / audio / video
|
# Response to files: image / PDF / audio / video
|
||||||
if message.url:
|
if message.url:
|
||||||
media_post, media_type = self._download(message)
|
media_post, media_type = self._download(message)
|
||||||
if media_post:
|
if media_post:
|
||||||
@ -182,10 +182,12 @@ class Logbot(Bot):
|
|||||||
else:
|
else:
|
||||||
reply = "Sorry, can't process that :( (unknown media type?)"
|
reply = "Sorry, can't process that :( (unknown media type?)"
|
||||||
|
|
||||||
|
# Response to @add
|
||||||
elif "@add" in message.text:
|
elif "@add" in message.text:
|
||||||
self._add_to_db(message)
|
self._add_to_db(message)
|
||||||
reply = "Added, thanks!"
|
reply = "Added, thanks!"
|
||||||
|
|
||||||
|
# Response to @delete
|
||||||
elif "@delete" in message.text:
|
elif "@delete" in message.text:
|
||||||
match = re.findall(r"@delete \d*", message.content)[0]
|
match = re.findall(r"@delete \d*", message.content)[0]
|
||||||
key = str(match.replace("@delete ", ""))
|
key = str(match.replace("@delete ", ""))
|
||||||
@ -199,12 +201,14 @@ class Logbot(Bot):
|
|||||||
else:
|
else:
|
||||||
reply = "This message is already gone!"
|
reply = "This message is already gone!"
|
||||||
|
|
||||||
|
# Response to @title
|
||||||
elif "@title" in message.text:
|
elif "@title" in message.text:
|
||||||
match = re.findall("@title .*", message.content)[0]
|
match = re.findall("@title .*", message.content)[0]
|
||||||
title = match.replace("@title", "")
|
title = match.replace("@title", "")
|
||||||
self.db[message.room]["title"] = title
|
self.db[message.room]["title"] = title
|
||||||
reply = f"The title of the log is changed to: { title }"
|
reply = f"The title of the log is changed to: { title }"
|
||||||
|
|
||||||
|
# Response to @style
|
||||||
elif "@style" in message.text:
|
elif "@style" in message.text:
|
||||||
reply = "This is a future-feature ..."
|
reply = "This is a future-feature ..."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user