Browse Source

adding spaces to the f strings when {} appear

master
manetta 4 years ago
parent
commit
1c1f871f2a
  1. 14
      LogBot/logbot.py

14
LogBot/logbot.py

@ -65,17 +65,17 @@ class Logbot(Bot):
media_type = "video"
else:
media_type = None
self.log.info(f"Unable to determine media type of {message.url.lower()}")
self.log.info(f"Unable to determine media type of { message.url.lower() }")
# download file
data = urllib.request.urlopen(message.url).read()
if data:
self.log.info(f"downloading: {message.url}")
self.log.info(f"downloading: { message.url }")
parsed_url = urlparse(message.url)
filename = (
os.path.basename(parsed_url.path).replace(" ", "_").replace("%20", "_")
) # safe url's
self.log.info(f"as the file: {filename}")
self.log.info(f"as the file: { filename }")
roomname = re.sub(r"@.*", "", message.room)
path = os.path.join(self.output, roomname, media_type)
if not os.path.isdir(path):
@ -169,9 +169,9 @@ class Logbot(Bot):
def group(self, message):
"""All the things LogBot does when it receives a group message."""
self.log.info("------------------")
self.log.info(f"message: {message.text}")
self.log.info(f"room: {message.room}")
self.log.info(f"sender: {message.sender}")
self.log.info(f"message: { message.text }")
self.log.info(f"room: { message.room }")
self.log.info(f"sender: { message.sender }")
self.log.info("------------------")
# image / PDF / audio / video
@ -194,7 +194,7 @@ class Logbot(Bot):
if key in self.db[message.room]["messages"]:
self.log.info(
f"To be deleted: {self.db[message.room]['messages'][key]}"
f"To be deleted: { self.db[message.room]['messages'][key] }"
)
reply = f"This message is deleted: { self.db[message.room]['messages'][key] }"
del self.db[message.room]["messages"][key]

Loading…
Cancel
Save