ILLEST Developers

illest.py 2.3.1

Embeds, permissions and intents

Read from the library itself: every signature and every word here is its own docstring.

Embed

class

illest.Embed

class Embed(title: 'str | None' = None, description: 'str | None' = None, url: 'str | None' = None, *, colour: 'Colour | int | None' = None, color: 'Colour | int | None' = None, timestamp: '_dt.datetime | int | None' = None, type: 'str' = 'rich')

A card. Every setter returns the embed, so calls chain.

colour

property

color

property

timestamp

property

set_timestamp

set_timestamp(value: '_dt.datetime | int | None' = None) -> "'Embed'"

Now, when given nothing (a shorthand of this library's).

footer

property

author

property

set_author

set_author(name: 'str', *, url: 'str | None' = None, icon_url: 'str | None' = None) -> "'Embed'"

remove_author

remove_author() -> "'Embed'"

image

property

set_image

set_image(url: 'str | None' = None) -> "'Embed'"

The card's picture, drawn full width. attachment://<filename> is a file sent with the message; an http(s) address is fetched by the bot's server as the message is sent and sealed with it, so it shows in place and readers never reach its host. An address the server will not fetch is shown as a link the reader may open.

thumbnail

property

set_thumbnail

set_thumbnail(url: 'str | None' = None) -> "'Embed'"

A small picture at the card's top right, taken as set_image takes its picture.

video

property

provider

property

fields

property

add_field

add_field(name: 'str', value: 'str', inline: 'bool' = True) -> "'Embed'"

insert_field_at

insert_field_at(index: 'int', name: 'str', value: 'str', inline: 'bool' = True) -> "'Embed'"

set_field_at

set_field_at(index: 'int', name: 'str', value: 'str', inline: 'bool' = True) -> "'Embed'"

remove_field

remove_field(index: 'int') -> "'Embed'"

clear_fields

clear_fields() -> "'Embed'"

copy

copy() -> "'Embed'"

to_dict

to_dict() -> 'dict[str, Any]'

The card as the wire carries it (content.ts's Embed), checked against every bound the client holds it to.

from_dict

classmethod
from_dict(data: 'Mapping[str, Any]') -> "'Embed'"

An embed from the wire's shape, or from the common one (icon_url, an ISO timestamp, color).

File

class

illest.File

class File(fp: 'str | bytes | os.PathLike | io.IOBase', filename: 'str | None' = None, *, spoiler: 'bool' = False, description: 'str | None' = None)

A file from a path, bytes, or an open binary file. spoiler=True names it SPOILER_..., which the client blurs.

read

read() -> 'bytes'

content_type

property

reset

reset(*, seek: 'bool' = True) -> 'None'

close

close() -> 'None'

MediaGalleryItem

class

illest.MediaGalleryItem

class MediaGalleryItem(media: 'Any', *, description: 'str | None' = None, spoiler: 'bool' = False)

One picture of a gallery.

to_picture

to_picture() -> 'dict[str, Any]'

UnfurledMediaItem

class

illest.UnfurledMediaItem

class UnfurledMediaItem(url: 'str')

A picture or a file a layout shows: attachment://<filename> or an http(s) address.

SeparatorSpacing

classfrom Enum

illest.SeparatorSpacing

class SeparatorSpacing(*values)

AskReply

class

illest.AskReply

class AskReply(*, placeholder: 'str | None' = None, user: 'Any' = None)

to_wire

to_wire() -> 'dict[str, Any]'

AllowedMentions

class

illest.AllowedMentions

class AllowedMentions(*, everyone: 'bool' = True, users: 'bool | list[Any]' = True, roles: 'bool | list[Any]' = True, replied_user: 'bool' = True)

everyone, users, roles and replied_user. users/roles may be True (all named), False (none), or a list of the ones allowed.

all

classmethod
all() -> "'AllowedMentions'"

none

classmethod
none() -> "'AllowedMentions'"

merge

merge(other: "'AllowedMentions'") -> "'AllowedMentions'"

allows_user

allows_user(user_id: 'int') -> 'bool'

Colour

class

illest.Colour

class Colour(value: 'int')

r

property

g

property

b

property

to_rgb

to_rgb() -> 'tuple[int, int, int]'

from_rgb

classmethod
from_rgb(r: 'int', g: 'int', b: 'int') -> "'Colour'"

from_hsv

classmethod
from_hsv(h: 'float', s: 'float', v: 'float') -> "'Colour'"

from_str

classmethod
from_str(value: 'str') -> "'Colour'"

#fff, #f71a14, 0xf71a14, f71a14 or rgb(247, 26, 20).

default

classmethod
default() -> "'Colour'"

random

classmethod
random(*, seed: 'int | str | float | bytes | bytearray | None' = None) -> "'Colour'"

illest

classmethod
illest() -> "'Colour'"

illest_light

classmethod
illest_light() -> "'Colour'"

illest_dark

classmethod
illest_dark() -> "'Colour'"

teal

classmethod
teal()

dark_teal

classmethod
dark_teal()

brand_green

classmethod
brand_green()

green

classmethod
green()

dark_green

classmethod
dark_green()

blue

classmethod
blue()

dark_blue

classmethod
dark_blue()

purple

classmethod
purple()

dark_purple

classmethod
dark_purple()

magenta

classmethod
magenta()

dark_magenta

classmethod
dark_magenta()

gold

classmethod
gold()

dark_gold

classmethod
dark_gold()

orange

classmethod
orange()

dark_orange

classmethod
dark_orange()

brand_red

classmethod
brand_red()

red

classmethod
red()

dark_red

classmethod
dark_red()

lighter_grey

classmethod
lighter_grey()

lighter_gray

classmethod
lighter_gray()

dark_grey

classmethod
dark_grey()

dark_gray

classmethod
dark_gray()

light_grey

classmethod
light_grey()

light_gray

classmethod
light_gray()

darker_grey

classmethod
darker_grey()

darker_gray

classmethod
darker_gray()

og_blurple

classmethod
og_blurple()

blurple

classmethod
blurple()

greyple

classmethod
greyple()

dark_theme

classmethod
dark_theme()

fuchsia

classmethod
fuchsia()

yellow

classmethod
yellow()

dark_embed

classmethod
dark_embed()

light_embed

classmethod
light_embed()

pink

classmethod
pink()

Permissions

class

illest.Permissions

class Permissions(permissions: 'int' = 0, **flags: 'bool')

A set of permission bits. Each name is a bool attribute; value is the integer the server stores.

is_subset

is_subset(other: "'Permissions'") -> 'bool'

is_superset

is_superset(other: "'Permissions'") -> 'bool'

is_strict_subset

is_strict_subset(other: "'Permissions'") -> 'bool'

is_strict_superset

is_strict_superset(other: "'Permissions'") -> 'bool'

update

update(**flags: 'bool') -> 'None'

handle_overwrite

handle_overwrite(allow: 'int', deny: 'int') -> 'None'

none

classmethod
none() -> "'Permissions'"

all

classmethod
all() -> "'Permissions'"

all_channel

classmethod
all_channel() -> "'Permissions'"

general

classmethod
general() -> "'Permissions'"

membership

classmethod
membership() -> "'Permissions'"

text

classmethod
text() -> "'Permissions'"

voice

classmethod
voice() -> "'Permissions'"

stage

classmethod
stage() -> "'Permissions'"

stage_moderator

classmethod
stage_moderator() -> "'Permissions'"

elevated

classmethod
elevated() -> "'Permissions'"

advanced

classmethod
advanced() -> "'Permissions'"

events

classmethod
events() -> "'Permissions'"

apps

classmethod
apps() -> "'Permissions'"

everyone

classmethod
everyone() -> "'Permissions'"

What a new server's @everyone holds (perms::DEFAULT_EVERYONE).

default

classmethod
default() -> "'Permissions'"

What a new server's @everyone holds (perms::DEFAULT_EVERYONE).

PermissionOverwrite

class

illest.PermissionOverwrite

class PermissionOverwrite(**flags: 'bool | None')

A channel's rule for one role or member: each permission allowed (True), denied (False) or left to the role (None).

pair

pair() -> 'tuple[Permissions, Permissions]'

from_pair

classmethod
from_pair(allow: 'Permissions | int', deny: 'Permissions | int') -> "'PermissionOverwrite'"

is_empty

is_empty() -> 'bool'

update

update(**flags: 'bool | None') -> 'None'

Intents

class

illest.Intents

class Intents(value: 'int | None' = None, **flags: 'bool')

A set of on/off flags, one per entry in FLAGS, each readable and settable as an attribute.

default

classmethod
default() -> "'Intents'"

all

classmethod
all() -> "'Intents'"

none

classmethod
none() -> "'Intents'"

from_value

classmethod
from_value(value: 'int') -> "'Intents'"

value

property

The flags as one number, a bit per intent in name order (Intents(value) reads it back).

is_subset

is_subset(other: "'Intents'") -> 'bool'

flags

property

Every intent and whether it is on.

allows

allows(event: 'str') -> 'bool'

Whether a handler named event (on_message) is handed anything. An event no intent names always is.

unfed

unfed(scopes: 'set[str]') -> 'list[tuple[str, tuple[str, ...]]]'

The intents that are on and that none of scopes could feed, each with the scopes that would.

SelectOption

class

illest.SelectOption

class SelectOption(*, label: 'str', value: 'Any' = None, description: 'str | None' = None, emoji: 'Any' = None, default: 'bool' = False)

to_wire

to_wire() -> 'dict[str, Any]'

from_wire

classmethod
from_wire(d: 'dict[str, Any]') -> "'SelectOption'"