Support file URLs

This commit is contained in:
Luke Murphy 2021-01-17 20:49:57 +01:00
parent 987a07e921
commit 12f3a0fc6f
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
4 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# xbotlib x.x.x (UNRELEASED)
# xbotlib 0.12.3 (2021-01-17)
- Support OOB URLs in `SimpleMessage`
# xbotlib 0.12.2 (2021-01-17)
- Support loading Jinja2 template ([#30](https://git.autonomic.zone/decentral1se/xbotlib/issues/30))

View File

@ -119,6 +119,7 @@ Attributes:
- **receiver**: the receiver of the message
- **nick**: the nickname of the sender
- **type**: the type of message
- **url**: The URL of a sent file
## Working with your bot

View File

@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
[tool.poetry]
name = "xbotlib"
version = "0.12.2"
version = "0.12.3"
description = "XMPP bots for humans"
authors = ["decentral1se <lukewm@riseup.net>"]
maintainers = ["decentral1se <lukewm@riseup.net>"]

View File

@ -85,6 +85,11 @@ class SimpleMessage:
"""The nick of the message."""
return self.message["mucnick"]
@property
def url(self):
"""The URL of a sent file."""
return self.message["oob"]["url"]
class Config:
"""Bot file configuration."""
@ -533,6 +538,7 @@ class Bot(ClientXMPP):
self.register_plugin("xep_0045") # Multi-User Chat
self.register_plugin("xep_0199") # XMPP Ping
self.register_plugin("xep_0084") # User Avatar
self.register_plugin("xep_0066") # Proces URIs (files, images)
try:
for plugin in self.plugins: