Permissions, scopes and intents
Three different switches decide what a bot does, and each is set by somebody different.
| Switch | Who sets it | What it decides |
|---|---|---|
| Scopes | the bot's owner, in the portal | what any of the bot's tokens may attempt at all |
| Permissions | each server, through the bot's role | what the bot may do in that server |
| Intents | your code | which events reach your handlers |
All three have to agree. A bot with the moderate scope can ban only where its role holds ban_members, above the member it
bans. A bot whose role may send messages but whose tokens lack messages.write sends nothing.
Scopes
Set on the bot's Bot page in the portal. The server holds every action a bot sends to them before anything else runs: bot actions lists each action and the scopes that let a bot send it.
| Scope | What it allows | Actions |
|---|---|---|
guilds.manage | Make and change channels, roles, invites and expressions, where the server's roles also allow it | 33 |
guilds.read | Read the servers it is in, and their channels | 17 |
members.read | Read who is in those servers | 3 |
messages.read | Read messages in channels it has been added to | 27 |
messages.write | Send messages as itself | 31 |
moderate | Use moderation actions, where the server's roles also allow it | 33 |
Permissions
illest.Permissions names ILLEST's own bits. Build invite links with it, or on the portal's Installation page, rather
than with a number from elsewhere:
import illest
from illest import utils
perms = illest.Permissions(send_messages=True, manage_messages=True, ban_members=True)
link = utils.oauth_url(1234, permissions=perms)The portal's Installation page builds the same link. The person adding the bot may untick any permission it asks for, and nobody can give a permission they do not hold themselves.
| Name | Bit | What it allows |
|---|---|---|
view_channel | 0 | View channels |
send_messages | 1 | Send messages |
manage_messages | 2 | Manage messages |
attach_files | 3 | Attach files |
add_reactions | 4 | Add reactions |
mention_everyone | 5 | Mention everyone |
pin_messagesILLEST only | 6 | Pin messages |
connect | 7 | Connect |
speak | 8 | Speak |
mute_members | 9 | Mute members |
deafen_members | 10 | Deafen members |
move_members | 11 | Move members |
create_instant_invite | 12 | create instant invite |
manage_channels | 13 | Manage channels |
manage_roles | 14 | Manage roles |
manage_guild | 15 | Manage server |
kick_members | 16 | Kick members |
ban_members | 17 | Ban members |
change_nickname | 18 | Change nickname |
manage_nicknames | 19 | Manage nicknames |
administrator | 20 | Administrator |
share_screenILLEST only | 21 | Share screen |
manage_stageILLEST only | 22 | Manage stages |
review_applicationsILLEST only | 23 | Review applications |
manage_expressions | 24 | Manage expressions |
manage_webhooks | 25 | Manage webhooks |
list_in_shopILLEST only | 26 | List in shops |
manage_shopILLEST only | 27 | Manage shops |
moderate_members | 28 | Time out members |
Some names have no bit of their own here, and read and write the bit that covers them, so code written against those names still runs:
| Name | ILLEST's bit |
|---|---|
create_events | manage_guild |
create_expressions | manage_expressions |
create_invite | create_instant_invite |
create_polls | send_messages |
create_private_threads | send_messages |
create_public_threads | send_messages |
embed_links | send_messages |
external_emojis | send_messages |
external_stickers | send_messages |
manage_emojis | manage_expressions |
manage_emojis_and_stickers | manage_expressions |
manage_events | manage_guild |
manage_permissions | manage_roles |
manage_server | manage_guild |
manage_threads | manage_messages |
priority_speaker | speak |
read_message_history | view_channel |
read_messages | view_channel |
request_to_speak | connect |
send_messages_in_threads | send_messages |
send_polls | send_messages |
send_tts_messages | send_messages |
send_voice_messages | send_messages |
start_embedded_activities | connect |
stream | share_screen |
timeout_members | moderate_members |
use_application_commands | send_messages |
use_embedded_activities | connect |
use_external_apps | send_messages |
use_external_emojis | send_messages |
use_external_sounds | speak |
use_external_stickers | send_messages |
use_soundboard | speak |
use_voice_activation | speak |
view_audit_log | manage_guild |
view_creator_monetization_analytics | manage_guild |
view_guild_insights | manage_guild |
Intents
The server pushes what the bot is a member of, without being asked, so an intent is a filter on the bot's side. An event whose intent is off is never handed to a handler, and a message whose intent is off is not even decrypted. An intent cannot grant anything: the library says at start, once, when an intent is on that none of the bot's scopes could feed.
import illest
intents = illest.Intents.default()
intents.typing = True
client = illest.Client(intents=intents)Intents.default() is every intent but typing and presences. Intents.all() is every one; Intents.none() is none.
| Intent | Default | Events | Fed by |
|---|---|---|---|
guilds | on | on_guild_join, on_guild_remove, on_guild_update, on_guild_delete, on_guild_available, on_channel_create, on_channel_update, on_guild_channel_create, on_guild_channel_update, on_guild_channel_delete, on_guild_role_create, on_guild_role_update, on_guild_role_delete, on_thread_create | guilds.read |
members | on | on_member_join, on_member_remove, on_member_update, on_raw_member_remove | members.read, guilds.read |
moderation | on | on_member_ban, on_member_unban, on_audit_log_entry_create | members.read, guilds.read |
voice_states | on | on_voice_state_update | guilds.read |
messages | on | on_message, on_missed_message, on_message_edit, on_message_delete, on_raw_message_edit, on_raw_message_delete, on_message_redact, on_raw_message_redact | messages.read |
reactions | on | on_reaction_add, on_reaction_remove, on_raw_reaction, on_raw_reaction_add, on_raw_reaction_remove | messages.read |
interactions | on | on_interaction | messages.read |
typing | off | on_typing, on_raw_typing | messages.read, messages.write |
presences | off | on_presence_update | none |
groups | on | on_group_join | none |
Finer-grained names set the intent they are a part of. ILLEST has one messages intent, and needs no privileged
message_content: a bot in a conversation's group reads it whole, or not at all.
| Name | Sets |
|---|---|
auto_moderation | moderation |
auto_moderation_configuration | moderation |
auto_moderation_execution | moderation |
bans | moderation |
dm_messages | messages |
dm_polls | messages |
dm_reactions | reactions |
dm_typing | typing |
emojis | guilds |
emojis_and_stickers | guilds |
expressions | guilds |
guild_messages | messages |
guild_polls | messages |
guild_reactions | reactions |
guild_scheduled_events | guilds |
guild_typing | typing |
integrations | guilds |
invites | guilds |
message_content | messages |
polls | messages |
webhooks | guilds |