Get some clickable links

This commit is contained in:
decentral1se 2021-06-03 16:22:38 +02:00
parent 3ac9282c88
commit 163175748f
No known key found for this signature in database
GPG Key ID: 92DAD76BD9567B8A

View File

@ -147,6 +147,9 @@ class Logbot(Bot):
self.db[message.room]["messages"][new_key] = media_post self.db[message.room]["messages"][new_key] = media_post
else: else:
post = message.content.replace("@add ", "") post = message.content.replace("@add ", "")
for url in re.findall(r"http\S+", post):
url_with_href = f"<a href='{url}'>{url}</a>"
post.replace(url, url_with_href)
self.db[message.room]["messages"][new_key] = post self.db[message.room]["messages"][new_key] = post
self.db._dumps() self.db._dumps()