illest.py 2.3.1
Models
What the library hands you: people, servers, channels, roles and messages.
Read from the library itself: every signature and every word here is its own docstring.
User
classfrom Messageableillest.User
class User(id: 'int', username: 'str' = '', bot: 'bool' = False, display_name: 'str | None' = None, raw: 'dict[str, Any] | None' = None, *, client: "'Client | None'" = None)
An account. name is its handle, global_name the name it shows; display_name is whichever it shows.
username
propertydisplay_name
propertymention
property<@id>. Sent in a message, the library writes it out as @name and notifies them.
avatar
propertydisplay_avatar
propertyaccent_colour
propertyaccent_color
propertycolour
propertycolor
propertycreated_at
propertydm_channel
propertymutual_guilds
propertymentioned_in
mentioned_in(message: "'Message'") -> 'bool'
create_dm
asyncasync create_dm() -> "'DMChannel'"
is_blocked
is_blocked() -> 'bool'
from_wire
classmethodfrom_wire(d: 'dict[str, Any]', client: "'Client | None'" = None) -> "'User'"
ClientUser
classfrom Userillest.ClientUser
class ClientUser(id: 'int', username: 'str' = '', bot: 'bool' = False, display_name: 'str | None' = None, raw: 'dict[str, Any] | None' = None, *, client: "'Client | None'" = None)
The bot's own account.
edit
asyncasync edit(*, username: 'str | None' = None, avatar: 'bytes | None' = None, bio: 'str | None' = None, display_name: 'str | None' = None) -> "'ClientUser'"
Change what the bot shows: its display name, its about text, its picture. Its handle is its owner's to change.
Member
classfrom Userillest.Member
class Member(guild_id: 'Any' = None, user: 'User | None' = None, nick: 'str | None' = None, roles: 'Iterable[Any]' = (), joined_at: 'Any' = 0, timed_out_until: 'Any' = None, raw: 'dict[str, Any] | None' = None, _client: "'Client | None'" = None)
An account in one server: its roles there, its nickname there, when it joined, and whether it is timed out.
Every attribute of User is here too.
user
propertyguild_id
propertyroles
propertyIts roles, @everyone first (lowest first).
top_role
propertyguild
propertydisplay_name
propertyguild_avatar
propertyjoined_at
propertytimed_out_until
propertycommunication_disabled_until
propertyis_timed_out
is_timed_out() -> 'bool'
colour
propertycolor
propertyguild_permissions
propertyvoice
propertystatus
propertyraw_status
propertyactivity
propertypending
propertypermissions_in
permissions_in(channel: "'GuildChannel'") -> 'Permissions'
kick
asyncasync kick(*, reason: 'str | None' = None) -> 'None'
Remove them from the server (moderate scope, and KICK_MEMBERS above them).
ban
asyncasync ban(*, reason: 'str | None' = None, delete_message_days: 'int' = 0, delete_message_seconds: 'int' = 0) -> 'None'
Ban them (moderate, BAN_MEMBERS). Their old messages stay: they are ciphertext in everybody's groups; a moderator
destroys one with Message.delete.
unban
asyncasync unban(*, reason: 'str | None' = None) -> 'None'
timeout
asyncasync timeout(until: 'Any', /, *, reason: 'str | None' = None) -> 'None'
Keep them from speaking: until is a timedelta, a datetime, seconds, or None to lift it (28 days at most).
add_roles
asyncasync add_roles(*roles: 'Any', reason: 'str | None' = None, atomic: 'bool' = True) -> 'None'
remove_roles
asyncasync remove_roles(*roles: 'Any', reason: 'str | None' = None, atomic: 'bool' = True) -> 'None'
edit
asyncasync edit(*, nick: 'str | None' = Ellipsis, roles: 'Sequence[Any] | None' = None, mute: 'bool | None' = None, deafen: 'bool | None' = None, voice_channel: 'Any' = Ellipsis, timed_out_until: 'Any' = Ellipsis, reason: 'str | None' = None, **_: 'Any') -> "'Member'"
move_to
asyncasync move_to(channel: 'Any', *, reason: 'str | None' = None) -> 'None'
Move them to another voice channel, or out of voice with None (moderate, MOVE_MEMBERS).
fetch_message
asyncasync fetch_message(id: 'int')
A message this bot holds. An end-to-end encrypted message is readable only once, as it arrives; the bot keeps the newest
max_messages (and, with Client(message_store=...), writes them to disk), and that is what it can fetch.
from_wire
classmethodfrom_wire(guild_id: 'Any', d: 'dict[str, Any]', client: "'Client | None'" = None) -> "'Member'"
Guild
classillest.Guild
class Guild(d: 'dict[str, Any]', client: "'Client | None'" = None)
A server, as the bot sees it: its name, owner, channels, roles and the members it has read.
channels
propertytext_channels
propertyvoice_channels
propertystage_channels
propertycategories
propertyforums
propertythreads
propertyby_category
by_category() -> "list[tuple['CategoryChannel | None', list['GuildChannel']]]"
roles
propertyLowest first, @everyone at the start.
default_role
propertymembers
propertymember_count
propertyemojis
propertyowner
propertyme
propertyicon
propertycreated_at
propertysystem_channel
propertyrules_channel
propertypublic_updates_channel
propertyvoice_client
propertychunked
propertyget_member
get_member(user_id: 'Any') -> 'Member | None'
get_member_named
get_member_named(name: 'str') -> 'Member | None'
get_role
get_role(role_id: 'Any') -> 'Role | None'
get_channel
get_channel(channel_id: 'Any') -> "'GuildChannel | None'"
get_channel_or_thread
get_channel_or_thread(channel_id: 'Any') -> "'GuildChannel | None'"
get_thread
get_thread(thread_id: 'Any') -> 'None'
get_emoji
get_emoji(emoji_id: 'Any') -> 'Emoji | None'
fetch_channels
asyncasync fetch_channels() -> "list['GuildChannel']"
fetch_channel
asyncasync fetch_channel(channel_id: 'Any') -> "'GuildChannel'"
fetch_roles
asyncasync fetch_roles() -> 'list[Role]'
fetch_role
asyncasync fetch_role(role_id: 'Any') -> 'Role'
fetch_members
fetch_members(*, limit: 'int | None' = 1000, after: 'Any' = None) -> 'AsyncIterator[Member]'
Everyone in the server (members.read), read from the server and kept in members.
chunk
asyncasync chunk(*, cache: 'bool' = True) -> 'list[Member]'
fetch_member
asyncasync fetch_member(member_id: 'Any') -> 'Member'
query_members
asyncasync query_members(query: 'str | None' = None, *, limit: 'int' = 5, user_ids: 'list[int] | None' = None, **_: 'Any') -> 'list[Member]'
fetch_emojis
asyncasync fetch_emojis() -> 'list[Emoji]'
fetch_emoji
asyncasync fetch_emoji(emoji_id: 'Any') -> 'Emoji'
kick
asyncasync kick(user: 'Any', *, reason: 'str | None' = None) -> 'None'
ban
asyncasync ban(user: 'Any', *, reason: 'str | None' = None, delete_message_days: 'int' = 0, delete_message_seconds: 'int' = 0) -> 'None'
unban
asyncasync unban(user: 'Any', *, reason: 'str | None' = None) -> 'None'
bulk_ban
asyncasync bulk_ban(users: 'Iterable[Any]', *, reason: 'str | None' = None, delete_message_seconds: 'int' = 0) -> 'Any'
bans
bans(*, limit: 'int | None' = 1000, before: 'Any' = None, after: 'Any' = None) -> "AsyncIterator['BanEntry']"
fetch_ban
asyncasync fetch_ban(user: 'Any') -> "'BanEntry'"
audit_logs
audit_logs(*, limit: 'int | None' = 100, before: 'Any' = None, after: 'Any' = None, oldest_first: 'bool' = False, user: 'Any' = None, action: 'Any' = None) -> "AsyncIterator['AuditLogEntry']"
The server's audit log (moderate): who did what, to whom, and why.
invites
asyncasync invites() -> "list['Invite']"
create_text_channel
asyncasync create_text_channel(name: 'str', **options: 'Any') -> "'TextChannel'"
create_voice_channel
asyncasync create_voice_channel(name: 'str', **options: 'Any') -> "'VoiceChannel'"
create_stage_channel
asyncasync create_stage_channel(name: 'str', **options: 'Any') -> "'StageChannel'"
create_forum
asyncasync create_forum(name: 'str', **options: 'Any') -> "'ForumChannel'"
create_forum_channel
asyncasync create_forum_channel(name: 'str', **options: 'Any') -> "'ForumChannel'"
create_category
asyncasync create_category(name: 'str', **options: 'Any') -> "'CategoryChannel'"
create_category_channel
asyncasync create_category_channel(name: 'str', **options: 'Any') -> "'CategoryChannel'"
create_role
asyncasync create_role(*, name: 'str' = 'new role', permissions: 'Permissions | None' = None, colour: 'Any' = None, color: 'Any' = None, hoist: 'bool' = False, mentionable: 'bool' = False, reason: 'str | None' = None, **_: 'Any') -> 'Role'
edit_role_positions
asyncasync edit_role_positions(positions: 'dict[Role, int]', *, reason: 'str | None' = None) -> 'list[Role]'
create_custom_emoji
asyncasync create_custom_emoji(*, name: 'str', image: 'bytes', roles: 'Any' = None, reason: 'str | None' = None) -> 'Emoji'
leave
asyncasync leave() -> 'None'
edit
asyncasync edit(**_: 'Any') -> "'Guild'"
delete
asyncasync delete() -> 'None'
vanity_invite
asyncasync vanity_invite() -> "'Invite | None'"
active_threads
asyncasync active_threads() -> "list['Thread']"
fetch_voice_states
asyncasync fetch_voice_states(channel: 'Any') -> 'list[VoiceState]'
from_wire
classmethodfrom_wire(d, client=None)
Role
classillest.Role
class Role(guild: "'Guild'", d: 'dict[str, Any]')
A server's role. The server's @everyone role has the server's own id.
color
propertyis_default
is_default() -> 'bool'
is_bot_managed
is_bot_managed() -> 'bool'
is_integration
is_integration() -> 'bool'
is_assignable
is_assignable() -> 'bool'
mention
propertymembers
propertycreated_at
propertyedit
asyncasync edit(*, name: 'str | None' = None, permissions: 'Permissions | None' = None, colour: 'Colour | int | None' = None, color: 'Colour | int | None' = None, hoist: 'bool | None' = None, mentionable: 'bool | None' = None, position: 'int | None' = None, reason: 'str | None' = None, **_: 'Any') -> "'Role'"
Change the role (guilds.manage scope, MANAGE_ROLES, and the bot's top role above it).
delete
asyncasync delete(*, reason: 'str | None' = None) -> 'None'
TextChannel
classfrom GuildChannel, Messageableillest.TextChannel
class TextChannel(d: 'dict[str, Any]', guild_id: 'Any' = None, client: "'Client | None'" = None)
A server's text channel.
last_message_id
propertylast_message
propertyis_news
is_news() -> 'bool'
threads
propertymembers
propertycreate_thread
asyncasync create_thread(*, name: 'str', message: 'Any' = None, auto_archive_duration: 'int' = 1440, type: 'Any' = None, reason: 'str | None' = None, invitable: 'bool' = True, slowmode_delay: 'int | None' = None) -> "'Thread'"
A thread under message (ILLEST threads hang off a message: one level, sealed in the channel's own group). Without a
message, the bot first sends name and the thread hangs off that.
get_thread
get_thread(thread_id: 'Any') -> "'Thread'"
purge
asyncasync purge(*, limit: 'int | None' = 100, check: 'Any' = None, before: 'Any' = None, after: 'Any' = None, around: 'Any' = None, oldest_first: 'bool | None' = None, bulk: 'bool' = True, reason: 'str | None' = None) -> "list['Message']"
Remove messages (moderate scope, MANAGE_MESSAGES). The bot destroys the stored ciphertext of each message it holds that
passes check; with no check and no bounds, the channel's newest limit are purged on the server in one step.
delete_messages
asyncasync delete_messages(messages: 'Iterable[Any]', *, reason: 'str | None' = None) -> 'None'
get_partial_message
get_partial_message(message_id: 'Any') -> "'PartialMessage'"
webhooks
asyncasync webhooks() -> 'list'
follow
asyncasync follow(**_: 'Any') -> 'None'
VoiceChannel
classfrom GuildChannelillest.VoiceChannel
class VoiceChannel(d: 'dict[str, Any]', guild_id: 'Any' = None, client: "'Client | None'" = None)
A voice channel. A bot can see who is in it and move, mute or disconnect them (moderate); it has no microphone, since
every call is encrypted from each device.
members
propertyvoice_states
propertyconnect
asyncasync connect(**_: 'Any') -> 'None'
StageChannel
classfrom VoiceChannelillest.StageChannel
class StageChannel(d: 'dict[str, Any]', guild_id: 'Any' = None, client: "'Client | None'" = None)
CategoryChannel
classfrom GuildChannelillest.CategoryChannel
class CategoryChannel(d: 'dict[str, Any]', guild_id: 'Any' = None, client: "'Client | None'" = None)
channels
propertytext_channels
propertyvoice_channels
propertycreate_text_channel
asyncasync create_text_channel(name: 'str', **options: 'Any') -> 'TextChannel'
create_voice_channel
asyncasync create_voice_channel(name: 'str', **options: 'Any') -> 'VoiceChannel'
create_forum
asyncasync create_forum(name: 'str', **options: 'Any') -> "'ForumChannel'"
ForumChannel
classfrom GuildChannelillest.ForumChannel
class ForumChannel(d: 'dict[str, Any]', guild_id: 'Any' = None, client: "'Client | None'" = None)
A forum: each post is a thread whose first message carries its title and tags, sealed like any message.
get_tag
get_tag(tag_id: 'Any') -> 'ForumTag | None'
threads
propertycreate_thread
asyncasync create_thread(*, name: 'str', content: 'str | None' = None, embed: 'Any' = None, embeds: 'Any' = None, file: 'Any' = None, files: 'Any' = None, view: 'Any' = None, applied_tags: 'Sequence[Any]' = (), allowed_mentions: 'Any' = None, reason: 'str | None' = None, **_: 'Any') -> "'ThreadWithMessage'"
Thread
classfrom Messageableillest.Thread
class Thread(parent: 'Any', root_wire_id: 'str', *, name: 'str | None' = None)
A thread: the messages hanging off one message in a channel. Its id is that first message's id. A thread lives in its channel's encrypted group, so everyone who reads the channel reads it.
parent_id
propertyguild
propertystarter_message
propertyowner_id
propertymention
propertyjump_url
propertyis_private
is_private() -> 'bool'
join
asyncasync join() -> 'None'
leave
asyncasync leave() -> 'None'
edit
asyncasync edit(**_: 'Any') -> "'Thread'"
DMChannel
classfrom PrivateBaseillest.DMChannel
class DMChannel(d: 'dict[str, Any]', client: "'Client | None'" = None)
A direct conversation with one account.
recipient
propertyme
propertyGroupChannel
classfrom PrivateBaseillest.GroupChannel
class GroupChannel(d: 'dict[str, Any]', client: "'Client | None'" = None)
A group conversation.
owner
propertyleave
asyncasync leave() -> 'None'
Message
classillest.Message
class Message(id: 'Any', channel_id: 'Any', author_id: 'int', body: 'str', sent_at: 'Any' = 0, embeds: 'list[dict] | None' = None, buttons: 'list[dict] | None' = None, visible_to: 'int | None' = None, author_verified: 'bool' = False, author_key_changed: 'bool' = False, late: 'bool' = False, reply_to: 'str | None' = None, thread_root: 'str | None' = None, mentions: 'list[int] | None' = None, attachments: 'list[dict] | None' = None, sender_device: 'str | None' = None, edited_at: 'float | None' = None, _client: "'Client | None'" = None, *, interaction: 'dict[str, Any] | None' = None, deferred: 'bool' = False, post: 'dict[str, Any] | None' = None, nonce: 'str | None' = None, silent: 'bool' = False, created_at: 'Any' = None)
A message, opened and proven.
author_verified is ILLEST's own: True only when the sender's device proves the account author names (a device certified by
that account, under the key this bot has known it by). A handler that authorises anything by who sent it checks it first.
id
propertycontent
propertyclean_content
propertysystem_content
propertycreated_at
propertyedited_at
propertychannel
propertyguild
propertyguild_id
propertyjump_url
propertyembeds
propertycomponents
propertyattachments
propertymentions
propertyrole_mentions
propertychannel_mentions
propertymention_everyone
propertyreference
propertyinteraction
propertyinteraction_metadata
propertytype
propertypinned
propertyreactions
propertythread
propertyephemeral
propertyis_system
is_system() -> 'bool'
reply
asyncasync reply(content: 'Any' = None, *, mention_author: 'bool | None' = None, **kwargs: 'Any') -> "'Message'"
send
asyncasync send(content: 'Any' = None, **kwargs: 'Any') -> "'Message'"
Send to the same channel (this library's first version had it; message.channel.send is the current way).
edit
asyncasync edit(content: 'Any' = Ellipsis, *, embed: 'Any' = Ellipsis, embeds: 'Any' = Ellipsis, attachments: 'Any' = Ellipsis, view: 'Any' = Ellipsis, delete_after: 'float | None' = None, suppress: 'bool' = False, allowed_mentions: 'Any' = None) -> "'Message'"
Change one of this bot's own messages: its text, its cards, its buttons. Every client ignores an edit from anybody else.
delete
asyncasync delete(*, delay: 'float | None' = None, reason: 'str | None' = None) -> 'None'
This bot's own message is taken back on every client. Somebody else's is destroyed on the server as a moderator
(moderate scope, MANAGE_MESSAGES), which removes its ciphertext for everyone.
redact
asyncasync redact() -> 'None'
add_reaction
asyncasync add_reaction(emoji: 'Any') -> 'None'
remove_reaction
asyncasync remove_reaction(emoji: 'Any', member: 'Any' = None) -> 'None'
clear_reaction
asyncasync clear_reaction(emoji: 'Any') -> 'None'
clear_reactions
asyncasync clear_reactions() -> 'None'
pin
asyncasync pin(*, reason: 'str | None' = None) -> 'None'
unpin
asyncasync unpin(*, reason: 'str | None' = None) -> 'None'
create_thread
asyncasync create_thread(*, name: 'str', **_: 'Any') -> 'Thread'
fetch
asyncasync fetch() -> "'Message'"
to_reference
to_reference(*, fail_if_not_exists: 'bool' = True) -> 'MessageReference'
publish
asyncasync publish() -> 'None'
forward
asyncasync forward(destination: 'Any', **_: 'Any') -> "'Message'"
PartialMessage
classillest.PartialMessage
class PartialMessage(*, channel: 'Any', id: 'int')
A message known by its id and channel only, for the verbs that need nothing else.
guild
propertyfetch
asyncasync fetch() -> 'Message'
delete
asyncasync delete(*, delay: 'float | None' = None) -> 'None'
add_reaction
asyncasync add_reaction(emoji: 'Any') -> 'None'
remove_reaction
asyncasync remove_reaction(emoji: 'Any', member: 'Any' = None) -> 'None'
pin
asyncasync pin(*, reason: 'str | None' = None) -> 'None'
unpin
asyncasync unpin(*, reason: 'str | None' = None) -> 'None'
reply
asyncasync reply(content: 'Any' = None, **kwargs: 'Any') -> 'Message'
edit
asyncasync edit(**kwargs: 'Any') -> 'Message'
to_reference
to_reference(**_: 'Any') -> 'MessageReference'
jump_url
propertyAttachment
classillest.Attachment
class Attachment(ref: 'dict[str, Any]', client: "'Client | None'" = None)
A file a message carries. It was sealed by its sender with a key that travels inside the message; read() fetches the
ciphertext and opens it here.
url
propertyproxy_url
propertyis_spoiler
is_spoiler() -> 'bool'
read
asyncasync read(*, use_cached: 'bool' = False) -> 'bytes'
save
asyncasync save(fp: 'Any', *, seek_begin: 'bool' = True, use_cached: 'bool' = False) -> 'int'
to_file
asyncasync to_file(*, filename: 'str | None' = None, description: 'str | None' = None, spoiler: 'bool' = False) -> 'Any'
Reaction
classillest.Reaction
class Reaction(channel_id: 'Any' = None, message_id: 'Any' = None, emoji: 'Any' = '', user_id: 'int' = 0, removed: 'bool' = False, burst: 'bool' = False, user_verified: 'bool' = False, message: 'Message | None' = None, *, count: 'int' = 1, me: 'bool' = False)
An emoji on a message. Delivered to on_reaction_add(reaction, user) and kept on message.reactions.
The first version of this library handed on_reaction_add the reaction alone, with its user_id; those fields stay.
is_custom_emoji
is_custom_emoji() -> 'bool'
users
users(*, limit: 'int | None' = None, after: 'Any' = None) -> 'AsyncIterator[User]'
remove
asyncasync remove(user: 'Any') -> 'None'
clear
asyncasync clear() -> 'None'
Emoji
classfrom PartialEmojiillest.Emoji
class Emoji(guild: "'Guild'", d: 'dict[str, Any]')
A server's own emoji.
url
propertydelete
asyncasync delete(*, reason: 'str | None' = None) -> 'None'
PartialEmoji
classillest.PartialEmoji
class PartialEmoji(*, name: 'str', id: 'int | None' = None, animated: 'bool' = False)
An emoji as a message carries it: a Unicode emoji (name only), or a server's (<:name:id>).
from_str
classmethodfrom_str(value: 'str') -> "'PartialEmoji'"
is_custom_emoji
is_custom_emoji() -> 'bool'
is_unicode_emoji
is_unicode_emoji() -> 'bool'
to_wire
to_wire() -> 'str'
Invite
classillest.Invite
class Invite(client: "'Client'", d: 'dict[str, Any]', guild: 'Guild | None' = None)
url
propertydelete
asyncasync delete(*, reason: 'str | None' = None) -> 'None'
BanEntry
classillest.BanEntry
class BanEntry(reason: 'str | None', user: 'User')
AuditLogEntry
classillest.AuditLogEntry
class AuditLogEntry(guild: 'Guild', d: 'dict[str, Any]')
One line of a server's audit log. action is the server's own word for it (member.kick, role.create...).
user
propertytarget
propertyObject
classillest.Object
class Object(id: 'Any', *, type: 'type | None' = None)
A stand-in with an id, and type to say what it stands for.
created_at
propertyAsset
classillest.Asset
class Asset(client: "'Client | None'", blob_id: 'str', *, kind: 'str' = 'avatar')
A picture the server keeps in the clear: an avatar, a banner, a server's icon. url is where it is read from.
url
propertyread
asyncasync read() -> 'bytes'
save
asyncasync save(fp: 'Any') -> 'int'
with_size
with_size(size: 'int') -> "'Asset'"
with_format
with_format(format: 'str') -> "'Asset'"
with_static_format
with_static_format(format: 'str') -> "'Asset'"