bot.utils.services#

Services.

Module Contents#

Functions#

send_to_paste_service(→ str)

Upload contents to the paste service.

Attributes#

bot.utils.services.log[source]#
bot.utils.services.FAILED_REQUEST_ATTEMPTS = 3[source]#
bot.utils.services.MAX_PASTE_LENGTH = 100000[source]#
exception bot.utils.services.PasteUploadError[source]#

Bases: Exception

Raised when an error is encountered uploading to the paste service.

exception bot.utils.services.PasteTooLongError[source]#

Bases: Exception

Raised when content is too large to upload to the paste service.

async bot.utils.services.send_to_paste_service(http_session: aiohttp.ClientSession, contents: str, *, extension: str = '', max_length: int = MAX_PASTE_LENGTH) str[source]#

Upload contents to the paste service.

Add extension to the output URL. Use max_length to limit the allowed contents length to lower than the maximum allowed by the paste service.

Raise ValueError if max_length is greater than the maximum allowed by the paste service. Raise PasteTooLongError if contents is too long to upload, and PasteUploadError if uploading fails.

Return the generated URL with the extension.