plugins: make set_bob async
This commit is contained in:
parent
f0508d8c83
commit
9c6e89d0e5
1 changed files with 2 additions and 2 deletions
|
@ -47,7 +47,7 @@ class Plugin(BasePlugin):
|
||||||
short='Send a short image',
|
short='Send a short image',
|
||||||
completion=self.completion_bob)
|
completion=self.completion_bob)
|
||||||
|
|
||||||
def command_bob(self, filename):
|
async def command_bob(self, filename):
|
||||||
path = Path(expanduser(filename))
|
path = Path(expanduser(filename))
|
||||||
try:
|
try:
|
||||||
size = path.stat().st_size
|
size = path.stat().st_size
|
||||||
|
@ -67,7 +67,7 @@ class Plugin(BasePlugin):
|
||||||
with open(path.as_posix(), 'rb') as file:
|
with open(path.as_posix(), 'rb') as file:
|
||||||
data = file.read()
|
data = file.read()
|
||||||
max_age = self.config.get('max_age')
|
max_age = self.config.get('max_age')
|
||||||
cid = self.core.xmpp.plugin['xep_0231'].set_bob(
|
cid = await self.core.xmpp.plugin['xep_0231'].set_bob(
|
||||||
data, mime_type, max_age=max_age)
|
data, mime_type, max_age=max_age)
|
||||||
self.api.run_command(
|
self.api.run_command(
|
||||||
'/xhtml <img src="cid:%s" alt="%s"/>' % (cid, path.name))
|
'/xhtml <img src="cid:%s" alt="%s"/>' % (cid, path.name))
|
||||||
|
|
Loading…
Reference in a new issue