forked from varia/bots
adding spaces to the f strings when {} appear
This commit is contained in:
parent
ccd695c462
commit
1c1f871f2a
@ -65,17 +65,17 @@ class Logbot(Bot):
|
|||||||
media_type = "video"
|
media_type = "video"
|
||||||
else:
|
else:
|
||||||
media_type = None
|
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
|
# download file
|
||||||
data = urllib.request.urlopen(message.url).read()
|
data = urllib.request.urlopen(message.url).read()
|
||||||
if data:
|
if data:
|
||||||
self.log.info(f"downloading: {message.url}")
|
self.log.info(f"downloading: { message.url }")
|
||||||
parsed_url = urlparse(message.url)
|
parsed_url = urlparse(message.url)
|
||||||
filename = (
|
filename = (
|
||||||
os.path.basename(parsed_url.path).replace(" ", "_").replace("%20", "_")
|
os.path.basename(parsed_url.path).replace(" ", "_").replace("%20", "_")
|
||||||
) # safe url's
|
) # 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)
|
roomname = re.sub(r"@.*", "", message.room)
|
||||||
path = os.path.join(self.output, roomname, media_type)
|
path = os.path.join(self.output, roomname, media_type)
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
@ -169,9 +169,9 @@ class Logbot(Bot):
|
|||||||
def group(self, message):
|
def group(self, message):
|
||||||
"""All the things LogBot does when it receives a group message."""
|
"""All the things LogBot does when it receives a group message."""
|
||||||
self.log.info("------------------")
|
self.log.info("------------------")
|
||||||
self.log.info(f"message: {message.text}")
|
self.log.info(f"message: { message.text }")
|
||||||
self.log.info(f"room: {message.room}")
|
self.log.info(f"room: { message.room }")
|
||||||
self.log.info(f"sender: {message.sender}")
|
self.log.info(f"sender: { message.sender }")
|
||||||
self.log.info("------------------")
|
self.log.info("------------------")
|
||||||
|
|
||||||
# image / PDF / audio / video
|
# image / PDF / audio / video
|
||||||
@ -194,7 +194,7 @@ class Logbot(Bot):
|
|||||||
|
|
||||||
if key in self.db[message.room]["messages"]:
|
if key in self.db[message.room]["messages"]:
|
||||||
self.log.info(
|
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] }"
|
reply = f"This message is deleted: { self.db[message.room]['messages'][key] }"
|
||||||
del self.db[message.room]["messages"][key]
|
del self.db[message.room]["messages"][key]
|
||||||
|
Loading…
Reference in New Issue
Block a user