Image generation

This module represents the image generation interface.

Note

All images retrieved with this module are placed in system default temporary folder. If the system doesn’t have a temporary folder images are placed in a current directory. Please note that you should practice file deletion after usage.

Image file object

To simplify file manipulation here is a weebapi.data_objects.ImageFile object. This also integrates nicely with discord.py

Note

By accessing the discord_file property you can get discord.File object.

class weebapi.data_objects.ImageFile(file_path: str)[source]

Represents a image file object usually retrieved from image generation.

file_path

str – Returns file path.

discord_file

discord.File – If discord.py is installed it returns a discord.File object, else raises an exception.

Raises

weebapi.errors.DiscordPyNotInstalled – Raised if discord.py is not installed, but discord.File object is requested.

delete()[source]

This function deletes the file.

Generators

Here is the list and the description of all available generators.

Note

Thus this is represented as a separate class, it’s loaded automatically into the weebapi.Client. If we assume that your client object is weeb = Client(token="SomeToken123") then you access simple image generator like this: generator = await weeb.img_gen.get_simple("won").

class weebapi.img_gen.ImgGen(client)[source]
discord_status(status: str = 'online', avatar: str = None) → weebapi.data_objects.ImageFile[source]

This function is a coroutine.

Generates a discord status image.

Available types:
  • online

  • idle

  • dnd

  • streaming

  • offline

Parameters
  • status (str) – Type of the image. See available types above.

  • avatar (str) – URL of the avatar.

Returns

weebapi.data_objects.ImageFile

get_simple(img_type: str, face_color: str = None, hair_color: str = None) → weebapi.data_objects.ImageFile[source]

This function is a coroutine.

Generates simple image.

Available types:
  • awooo

  • eyes

  • won

Parameters
  • img_type (str) – Type of the image. See available types above.

  • face_color (str) – Only for awooo type. HEX string for color.

  • hair_color (str) – Only for awooo type. HEX string for color.

Returns

weebapi.data_objects.ImageFile

license(title: str, avatar: str, badges: list = [], widgets: list = []) → weebapi.data_objects.ImageFile[source]

This function is a coroutine.

Generates a spook license.

Parameters
  • title (str) – Title of the card.

  • avatar (str) – URL of the avatar.

  • badges (list Optional) – List of string URLs of the images. Max 3.

  • widgets (list Optional) – List of strings. Max 3.

Returns

weebapi.data_objects.ImageFile

love(avatar1: str, avatar2: str) → weebapi.data_objects.ImageFile[source]

This function is a coroutine.

Generates a love image.

Parameters
  • avatar1 (str) – URL of the avatar displayed on the left.

  • avatar2 (str) – URL of the avatar displayed on the right.

Returns

weebapi.data_objects.ImageFile

waifu_insult(avatar: str) → weebapi.data_objects.ImageFile[source]

This function is a coroutine.

Generates a waifu insult.

Parameters

avatar (str) – URL of the avatar.

Returns

weebapi.data_objects.ImageFile