1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

publish: 5.8.9

This commit is contained in:
Steffo 2020-05-19 18:14:26 +02:00
parent 9c139ed4ed
commit c2d2d2543f
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
5 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@
[tool.poetry] [tool.poetry]
name = "royalnet" name = "royalnet"
version = "5.8.8" version = "5.8.9"
description = "A multipurpose bot and web framework" description = "A multipurpose bot and web framework"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"] authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+" license = "AGPL-3.0+"

View file

@ -52,7 +52,7 @@ class CommandData:
text: The text to be sent, possibly formatted in the weird undescribed markup that I'm using.""" text: The text to be sent, possibly formatted in the weird undescribed markup that I'm using."""
raise UnsupportedError(f"'{self.reply.__name__}' is not supported") raise UnsupportedError(f"'{self.reply.__name__}' is not supported")
async def reply_image(self, image: io.IOBase, caption: str) -> None: async def reply_image(self, image: io.IOBase, caption: Optional[str] = None) -> None:
"""Send an image (with optionally a caption) to the channel where the call was made. """Send an image (with optionally a caption) to the channel where the call was made.
Parameters: Parameters:

View file

@ -78,8 +78,8 @@ class DiscordSerf(Serf):
async def reply(data, text: str): async def reply(data, text: str):
await data.message.channel.send(escape(text)) await data.message.channel.send(escape(text))
async def reply_image(data, image: io.IOBase, caption: str) -> None: async def reply_image(data, image: io.IOBase, caption: Optional[str] = None) -> None:
await data.message.channel.send(file=discord.File(image, 'image')) await data.message.channel.send(caption, file=discord.File(image, 'image'))
async def get_author(data, error_if_none=False): async def get_author(data, error_if_none=False):
user: "discord.Member" = data.message.author user: "discord.Member" = data.message.author

View file

@ -117,10 +117,10 @@ class TelegramSerf(Serf):
parse_mode="HTML", parse_mode="HTML",
disable_web_page_preview=True) disable_web_page_preview=True)
async def reply_image(data, image: io.IOBase, caption: str) -> None: async def reply_image(data, image: io.IOBase, caption: Optional[str] = None) -> None:
await self.api_call(data.message.chat.send_photo, await self.api_call(data.message.chat.send_photo,
photo=image, photo=image,
caption=escape(caption), caption=escape(caption) if caption is not None else None,
parse_mode="HTML", parse_mode="HTML",
disable_web_page_preview=True) disable_web_page_preview=True)

View file

@ -1 +1 @@
semantic = "5.8.8" semantic = "5.8.9"