Guild Models#
- enum interactions.api.models.guild.VerificationLevel(value)[source]#
An enumerable object representing the verification level of a guild.
- Member Type:
Valid values are as follows:
- NONE = <VerificationLevel.NONE: 0>#
- LOW = <VerificationLevel.LOW: 1>#
- MEDIUM = <VerificationLevel.MEDIUM: 2>#
- HIGH = <VerificationLevel.HIGH: 3>#
- VERY_HIGH = <VerificationLevel.VERY_HIGH: 4>#
- enum interactions.api.models.guild.EntityType(value)[source]#
An enumerable object representing the type of event.
- Member Type:
Valid values are as follows:
- STAGE_INSTANCE = <EntityType.STAGE_INSTANCE: 1>#
- VOICE = <EntityType.VOICE: 2>#
- EXTERNAL = <EntityType.EXTERNAL: 3>#
- enum interactions.api.models.guild.DefaultMessageNotificationLevel(value)[source]#
An enumerable object representing the default message notification level of a guild.
- Member Type:
Valid values are as follows:
- ALL_MESSAGES = <DefaultMessageNotificationLevel.ALL_MESSAGES: 0>#
- ONLY_MENTIONS = <DefaultMessageNotificationLevel.ONLY_MENTIONS: 1>#
- class interactions.api.models.guild.EventMetadata(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the metadata of an event entity.
- Variables:
location (Optional[str]) – The location of the event, if any.
- enum interactions.api.models.guild.EventStatus(value)[source]#
An enumerable object representing the status of an event.
- Member Type:
Valid values are as follows:
- SCHEDULED = <EventStatus.SCHEDULED: 1>#
- ACTIVE = <EventStatus.ACTIVE: 2>#
- COMPLETED = <EventStatus.COMPLETED: 3>#
- CANCELED = <EventStatus.CANCELED: 4>#
- class interactions.api.models.guild.GuildTemplate(kwargs_dict=None, /, **other_kwargs)[source]#
An object representing the snapshot of an existing guild.
- Variables:
code (str) – The code of the guild template.
name (str) – The name of the guild template.
description (Optional[str]) – The description of the guild template, if given.
usage_count (int) – The amount of uses on the template.
creator_id (Snowflake) – User ID of the creator of this template.
creator (User) – The User object of the creator of this template.
created_at (datetime) – The time when this template was created.
update_at (datetime) – The time when this template was updated.
source_guild_id (Snowflake) – The Guild ID that the template sourced from.
serialized_source_guild (Guild) – A partial Guild object from the sourced template.
is_dirty (Optional[bool]) – A status that denotes if the changes are unsynced.
- class interactions.api.models.guild.Integration(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing an integration in a guild.
- Variables:
id (Snowflake) – The ID of the integration.
name (str) – The name of the integration.
type (str) – The type of integration.
enabled (bool) – Whether the integration is enabled or not.
syncing (bool) – Whether the integration is syncing or not.
role_id (Snowflake) – The role ID that the integration uses for “subscribed” users.
enable_emoticons (bool) – Whether emoticons should be enabled or not.
expire_behavior (int) – The expiration behavior of the integration.
expire_grace_period (int) – The “grace period” of the integration when expired – how long it can still be used.
user (User) – The user of the integration.
account (Any) – The account of the integration.
synced_at (datetime) – The time that the integration was last synced.
subscriber_count (int) – The current subscriber count of the integration.
revoked (bool) – Whether the integration was revoked for use or not.
application (Application) – The application used for the integration.
- enum interactions.api.models.guild.InviteTargetType(value)[source]#
An enumerable object representing the different invite target types
- Member Type:
Valid values are as follows:
- STREAM = <InviteTargetType.STREAM: 1>#
- EMBEDDED_APPLICATION = <InviteTargetType.EMBEDDED_APPLICATION: 2>#
- class interactions.api.models.guild.StageInstance(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing an instance of a stage channel in a guild.
- Variables:
id (Snowflake) – The ID of the stage.
guild_id (Snowflake) – The guild ID the stage is in.
channel_id (Snowflake) – The channel ID the stage is instantiated from.
topic (str) – The topic of the stage.
privacy_level (int) – The “privacy”/inclusive accessibility level of the stage.
discoverable_disabled (bool) – Whether the stage can be seen from the stage discovery.
A class object representing how a guild that is unavailable.
Note
This object only seems to show up during the connection process of the client to the Gateway when the
READY
event is dispatched. This event will pass fields withguilds
where this becomes present.
- class interactions.api.models.guild.WelcomeChannels(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing a welcome channel on the welcome screen.
Note
emoji_id
andemoji_name
are given values respectively if the welcome channel uses an emoji.
- enum interactions.api.models.guild.ExplicitContentFilterLevel(value)[source]#
An enumerable object representing the explicit content filter level of a guild.
- Member Type:
Valid values are as follows:
- DISABLED = <ExplicitContentFilterLevel.DISABLED: 0>#
- MEMBERS_WITHOUT_ROLES = <ExplicitContentFilterLevel.MEMBERS_WITHOUT_ROLES: 1>#
- ALL_MEMBERS = <ExplicitContentFilterLevel.ALL_MEMBERS: 2>#
- class interactions.api.models.guild.ScheduledEvents(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the scheduled events of a guild.
- Variables:
id (Snowflake) – The ID of the scheduled event.
guild_id (Snowflake) – The ID of the guild that this scheduled event belongs to.
channel_id (Optional[Snowflake]) – The channel ID in which the scheduled event belongs to, if any.
creator_id (Optional[Snowflake]) – The ID of the user that created the scheduled event.
name (str) – The name of the scheduled event.
description (str) – The description of the scheduled event.
scheduled_start_time (datetime) – The scheduled event start time.
scheduled_end_time (Optional[datetime]) – The scheduled event end time, if any.
privacy_level (int) – The privacy level of the scheduled event.
entity_type (int) – The type of the scheduled event.
entity_id (Optional[Snowflake]) – The ID of the entity associated with the scheduled event.
entity_metadata (Optional[EventMetadata]) – Additional metadata associated with the scheduled event.
creator (Optional[User]) – The user that created the scheduled event.
user_count (Optional[int]) – The number of users subscribed to the scheduled event.
status (int) – The status of the scheduled event
image (Optional[str]) – The hash containing the image of an event, if applicable.
- class interactions.api.models.guild.WelcomeScreen(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the welcome screen shown for community guilds.
- Variables:
description (Optional[str]) – The description of the welcome screen.
welcome_channels (List[WelcomeChannels]) – A list of welcome channels of the welcome screen.
- class interactions.api.models.guild.Guild(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing how a guild is registered.
Note
Most of these optionals are actually declared with their value upon instantiation but are kept like this since this class object is meant to be more broad and generalized.
- Variables:
id (Snowflake) – The ID of the guild.
name (str) – The name of the guild.
icon (Optional[str]) – The icon of the guild.
icon_hash (Optional[str]) – The hashed version of the icon of the guild.
splash (Optional[str]) – The invite splash banner of the guild.
discovery_splash (Optional[str]) – The discovery splash banner of the guild.
owner (Optional[bool]) – Whether the guild is owned.
owner_id (Snowflake) – The ID of the owner of the guild.
permissions (Optional[str]) – The permissions of the guild.
region (Optional[str]) – The geographical region of the guild.
afk_channel_id (Optional[Snowflake]) – The AFK voice channel of the guild.
afk_timeout (int) – The timeout of the AFK voice channel of the guild.
widget_enabled (Optional[bool]) – Whether widgets are enabled in the guild.
widget_channel_id (Optional[Snowflake]) – The channel ID of the widget in the guild.
verification_level (int) – The level of user verification of the guild.
default_message_notifications (int) – The default message notifications setting of the guild.
explicit_content_filter (int) – The explicit content filter setting level of the guild.
roles (List[Role]) – The list of roles in the guild.
emojis (List[Emoji]) – The list of emojis from the guild.
features (List[GuildFeature]) – The list of features of the guild.
mfa_level (int) – The MFA level of the guild.
application_id (Optional[Snowflake]) – The application ID of the guild.
system_channel_id (Optional[Snowflake]) – The channel ID of the system of the guild.
rules_channel_id (Optional[Snowflake]) – The channel ID of Discord’s defined “rules” channel of the guild.
joined_at (Optional[datetime]) – The timestamp the member joined the guild.
large (Optional[bool]) – Whether the guild is considered “large.”
unavailable (Optional[bool]) – Whether the guild is unavailable to access.
member_count (Optional[int]) – The amount of members in the guild.
members (Optional[List[Member]]) – The members in the guild.
channels (Optional[List[Channel]]) – The channels in the guild.
threads (Optional[List[Thread]]) – All known threads in the guild.
presences (Optional[List[PresenceUpdate]]) – The list of presences in the guild.
max_presences (Optional[int]) – The maximum amount of presences allowed in the guild.
max_members (Optional[int]) – The maximum amount of members allowed in the guild.
vanity_url_code (Optional[str]) – The vanity URL of the guild.
description (Optional[str]) – The description of the guild.
banner (Optional[str]) – The banner of the guild.
premium_tier (int) – The server boost level of the guild.
premium_subscription_count (Optional[int]) – The amount of server boosters in the guild.
preferred_locale (str) – The “preferred” local region of the guild.
public_updates_channel_id (Optional[Snowflake]) – The channel ID for community updates of the guild.
max_video_channel_users (Optional[int]) – The maximum amount of video streaming members in a channel allowed in a guild.
approximate_member_count (Optional[int]) – The approximate amount of members in the guild.
approximate_presence_count (Optional[int]) – The approximate amount of presences in the guild.
welcome_screen (Optional[WelcomeScreen]) – The welcome screen of the guild.
nsfw_level (int) – The NSFW safety filter level of the guild.
stage_instances (Optional[List[StageInstance]]) – The stage instance of the guild.
stickers (Optional[List[Sticker]]) – The list of stickers from the guild.
premium_progress_bar_enabled (Optional[bool]) – Whether the guild has the boost progress bar enabled.
- property voice_states: List[VoiceState]#
New in version 4.4.0.
Gets all voice states of the guild.
- Return type:
List[VoiceState]
- property mapped_voice_states: Dict[int, List[VoiceState]]#
New in version 4.4.0.
Returns all the voice states mapped after their channel id.
- Return type:
Dict[int, List[VoiceState]]
- async ban(member_id, seconds=0, minutes=<interactions.MISSING>, hours=<interactions.MISSING>, days=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Changed in version 4.3.2: Method has been aligned to changes in the Discord API. You can now input days, hours, minutes and seconds, as long as it doesn’t exceed 604800 seconds in total for deleting messages, instead of only days.
Bans a member from the guild.
- Parameters:
member_id (Union[int, Member, Snowflake]) – The id of the member to ban
seconds (Optional[int]) – Number of seconds to delete messages, from 0 to 604800. Defaults to 0
minutes (Optional[int]) – Number of minutes to delete messages, from 0 to 10080
hours (Optional[int]) – Number of hours to delete messages, from 0 to 168
days (Optional[int]) – Number of days to delete messages, from 0 to 7
reason (Optional[str]) – The reason of the ban
- async add_member_role(role, member_id, reason=None)[source]#
New in version 4.0.2.
This method adds a role to a member.
- async remove_member_role(role, member_id, reason=None)[source]#
New in version 4.0.2.
This method removes a or multiple role(s) from a member.
- async create_role(name, permissions=<interactions.MISSING>, color=0, hoist=False, icon=<interactions.MISSING>, unicode_emoji=<interactions.MISSING>, mentionable=False, reason=None)[source]#
New in version 4.0.2.
Creates a new role in the guild.
- Parameters:
name (str) – The name of the role
color (Optional[int]) – RGB color value as integer, default
0
permissions (Optional[int]) – Bitwise value of the enabled/disabled permissions
hoist (Optional[bool]) – Whether the role should be displayed separately in the sidebar, default
False
icon (Optional[Image]) – The role’s icon image (if the guild has the ROLE_ICONS feature)
unicode_emoji (Optional[str]) – The role’s unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature)
mentionable (Optional[bool]) – Whether the role should be mentionable, default
False
reason (Optional[str]) – The reason why the role is created, default
None
- Returns:
The created Role
- Return type:
- async get_member(member_id)[source]#
New in version 4.0.2.
Searches for the member with specified id in the guild and returns the member as member object.
- async delete_role(role_id, reason=None)[source]#
New in version 4.0.2.
Deletes a role from the guild.
- async modify_role(role_id, name=<interactions.MISSING>, permissions=<interactions.MISSING>, color=<interactions.MISSING>, hoist=<interactions.MISSING>, icon=<interactions.MISSING>, unicode_emoji=<interactions.MISSING>, mentionable=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Edits a role in the guild.
- Parameters:
role_id (Union[int, Snowflake, Role]) – The id of the role to edit
name (Optional[str]) – The name of the role, defaults to the current value of the role
color (Optional[int]) – RGB color value as integer, defaults to the current value of the role
permissions (Optional[int]) – Bitwise value of the enabled/disabled permissions, defaults to the current value of the role
hoist (Optional[bool]) – Whether the role should be displayed separately in the sidebar, defaults to the current value of the role
icon (Optional[Image]) – The role’s icon image (if the guild has the ROLE_ICONS feature), defaults to the current value of the role
unicode_emoji (Optional[str]) – The role’s unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature), defaults to the current value of the role
mentionable (Optional[bool]) – Whether the role should be mentionable, defaults to the current value of the role
reason (Optional[str]) – The reason why the role is edited, default
None
- Returns:
The modified role object
- Return type:
- async create_thread(name, channel_id, type=ChannelType.PUBLIC_THREAD, auto_archive_duration=<interactions.MISSING>, invitable=<interactions.MISSING>, message_id=<interactions.MISSING>, reason=None)[source]#
New in version 4.1.0.
Creates a thread in the specified channel.
- Parameters:
name (str) – The name of the thread
channel_id (Union[int, Snowflake, Channel]) – The id of the channel to create the thread in
auto_archive_duration (Optional[int]) – duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
type (Optional[ChannelType]) – The type of thread, defaults to public. ignored if creating thread from a message
invitable (Optional[bool]) – Boolean to display if the Thread is open to join or private.
message_id (Optional[Union[int, Snowflake, Message]]) – An optional message to create a thread from.
reason (Optional[str]) – An optional reason for the audit log
- Returns:
The created thread
- Return type:
- async create_channel(name, type, topic=<interactions.MISSING>, bitrate=<interactions.MISSING>, user_limit=<interactions.MISSING>, rate_limit_per_user=<interactions.MISSING>, position=<interactions.MISSING>, permission_overwrites=<interactions.MISSING>, parent_id=<interactions.MISSING>, nsfw=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Creates a channel in the guild.
- Parameters:
name (str) – The name of the channel
type (ChannelType) – The type of the channel
topic (Optional[str]) – The topic of that channel
bitrate (Optional[int]) – (voice channel only) The bitrate (in bits) of the voice channel
user_limit (Optional[int]) – (voice channel only) Maximum amount of users in the channel
rate_limit_per_use (Optional[int]) – Amount of seconds a user has to wait before sending another message (0-21600)
position (Optional[int]) – Sorting position of the channel
parent_id (Optional[Union[int, Channel, Snowflake]]) – The id of the parent category for a channel
permission_overwrites (Optional[List[Overwrite]]) – The permission overwrites, if any
nsfw (Optional[bool]) – Whether the channel is nsfw or not, default
False
reason (Optional[str]) – The reason for the creation
- Returns:
The created channel
- Return type:
- async modify_channel(channel_id, name=<interactions.MISSING>, topic=<interactions.MISSING>, bitrate=<interactions.MISSING>, user_limit=<interactions.MISSING>, rate_limit_per_user=<interactions.MISSING>, position=<interactions.MISSING>, permission_overwrites=<interactions.MISSING>, parent_id=<interactions.MISSING>, nsfw=<interactions.MISSING>, archived=<interactions.MISSING>, auto_archive_duration=<interactions.MISSING>, locked=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Edits a channel of the guild.
New in version 4.2.0::: The fields
archived
,auto_archive_duration
andlocked
require the provided channel to be a thread.- Parameters:
channel_id (Union[int, Snowflake, Channel]) – The id of the channel to modify
name (str) – The name of the channel, defaults to the current value of the channel
topic (Optional[str]) – The topic of that channel, defaults to the current value of the channel
bitrate (Optional[int]) – (voice channel only) The bitrate (in bits) of the voice channel, defaults to the current value of the channel
user_limit (Optional[int]) – (voice channel only) Maximum amount of users in the channel, defaults to the current value of the channel
rate_limit_per_user (Optional[int]) – Amount of seconds a user has to wait before sending another message (0-21600), defaults to the current value of the channel
position (Optional[int]) – Sorting position of the channel, defaults to the current value of the channel
parent_id (Optional[int]) – The id of the parent category for a channel, defaults to the current value of the channel
permission_overwrites (Optional[Overwrite]) – The permission overwrites, if any
nsfw (Optional[bool]) – Whether the channel is nsfw or not, defaults to the current value of the channel
archived (Optional[bool]) –
New in version 4.2.0.
Whether the thread is archived
auto_archive_duration (Optional[Literal[60, 1440, 4320, 10080]]) –
New in version 4.2.0.
The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
locked (Optional[bool]) –
New in version 4.2.0.
Whether the thread is locked
reason (Optional[str]) – The reason for the edit
- Returns:
The modified channel
- Return type:
- async modify_member(member_id, nick=<interactions.MISSING>, roles=<interactions.MISSING>, mute=<interactions.MISSING>, deaf=<interactions.MISSING>, channel_id=<interactions.MISSING>, communication_disabled_until=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Modifies a member of the guild.
- Parameters:
member_id (Union[int, Snowflake, Member]) – The id of the member to modify
nick (Optional[str]) – The nickname of the member
roles (Optional[List[int]]) – A list of all role ids the member has
mute (Optional[bool]) – whether the user is muted in voice channels
deaf (Optional[bool]) – whether the user is deafened in voice channels
channel_id (Optional[int]) – id of channel to move user to (if they are connected to voice)
communication_disabled_until (Optional[datetime.isoformat]) – when the user’s timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future)
reason (Optional[str]) – The reason of the modifying
- Returns:
The modified member
- Return type:
- async get_preview()[source]#
New in version 4.0.2.
Get the guild’s preview.
- Returns:
the guild preview as object
- Return type:
- async modify(name=<interactions.MISSING>, verification_level=<interactions.MISSING>, default_message_notifications=<interactions.MISSING>, explicit_content_filter=<interactions.MISSING>, afk_channel_id=<interactions.MISSING>, afk_timeout=<interactions.MISSING>, icon=<interactions.MISSING>, owner_id=<interactions.MISSING>, splash=<interactions.MISSING>, discovery_splash=<interactions.MISSING>, banner=<interactions.MISSING>, system_channel_id=<interactions.MISSING>, suppress_join_notifications=<interactions.MISSING>, suppress_premium_subscriptions=<interactions.MISSING>, suppress_guild_reminder_notifications=<interactions.MISSING>, suppress_join_notification_replies=<interactions.MISSING>, rules_channel_id=<interactions.MISSING>, public_updates_channel_id=<interactions.MISSING>, preferred_locale=<interactions.MISSING>, description=<interactions.MISSING>, premium_progress_bar_enabled=<interactions.MISSING>, reason=None)[source]#
New in version 4.0.2.
Modifies the current guild.
- Parameters:
name (Optional[str]) – The new name of the guild
verification_level (Optional[VerificationLevel]) – The verification level of the guild
default_message_notifications (Optional[DefaultMessageNotificationLevel]) – The default message notification level for members
explicit_content_filter (Optional[ExplicitContentFilterLevel]) – The explicit content filter level for media content
afk_channel_id (Optional[int]) – The id for the afk voice channel
afk_timeout (Optional[int]) – Afk timeout in seconds
icon (Optional[Image]) –
New in version 4.2.0.
1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the ANIMATED_ICON feature)
owner_id (Optional[int]) – The id of the user to transfer the guild ownership to. You must be the owner to perform this
splash (Optional[Image]) –
New in version 4.2.0.
16:9 png/jpeg image for the guild splash (when the server has the INVITE_SPLASH feature)
discovery_splash (Optional[Image]) –
New in version 4.2.0.
16:9 png/jpeg image for the guild discovery splash (when the server has the DISCOVERABLE feature)
banner (Optional[Image]) –
New in version 4.2.0.
16:9 png/jpeg image for the guild banner (when the server has the BANNER feature; can be animated gif when the server has the ANIMATED_BANNER feature)
system_channel_id (Optional[int]) – The id of the channel where guild notices such as welcome messages and boost events are posted
suppress_join_notifications (Optional[bool]) – Whether to suppress member join notifications in the system channel or not
suppress_premium_subscriptions (Optional[bool]) – Whether to suppress server boost notifications in the system channel or not
suppress_guild_reminder_notifications (Optional[bool]) – Whether to suppress server setup tips in the system channel or not
suppress_join_notification_replies (Optional[bool]) – Whether to hide member join sticker reply buttons in the system channel or not
rules_channel_id (Optional[int]) – The id of the channel where guilds display rules and/or guidelines
public_updates_channel_id (Optional[int]) – The id of the channel where admins and moderators of community guilds receive notices from Discord
preferred_locale (Optional[str]) – The preferred locale of a community guild used in server discovery and notices from Discord; defaults to “en-US”
description (Optional[str]) – The description for the guild, if the guild is discoverable
premium_progress_bar_enabled (Optional[bool]) – Whether the guild’s boost progress bar is enabled
reason (Optional[str]) – The reason for the modifying
- Returns:
The modified guild
- Return type:
- async set_verification_level(verification_level, *, reason=None)[source]#
New in version 4.2.0.
Sets the verification level of the guild.
- Parameters:
verification_level (VerificationLevel) – The new verification level of the guild
reason (Optional[str]) – The reason of the edit
- Return type:
- async set_default_message_notifications(default_message_notifications, *, reason=None)[source]#
New in version 4.2.0.
Sets the default message notifications level of the guild.
- Parameters:
default_message_notifications (DefaultMessageNotificationLevel) – The new default message notification level of the guild
reason (Optional[str]) – The reason of the edit
- Return type:
- async set_explicit_content_filter(explicit_content_filter, *, reason=None)[source]#
New in version 4.2.0.
Sets the explicit content filter level of the guild.
- Parameters:
explicit_content_filter (ExplicitContentFilterLevel) – The new explicit content filter level of the guild
reason (Optional[str]) – The reason of the edit
- Return type:
- async set_afk_channel(afk_channel_id, *, reason=None)[source]#
New in version 4.2.0.
Sets the afk channel of the guild.
- async set_afk_timeout(afk_timeout, *, reason=None)[source]#
New in version 4.2.0.
Sets the afk timeout of the guild.
- async set_system_channel(system_channel_id, *, reason=None)[source]#
New in version 4.2.0.
Sets the system channel of the guild.
- async set_rules_channel(rules_channel_id, *, reason=None)[source]#
New in version 4.2.0.
Sets the rules channel of the guild.
- async set_public_updates_channel(public_updates_channel_id, *, reason=None)[source]#
New in version 4.2.0.
Sets the public updates channel of the guild.
- async set_preferred_locale(preferred_locale, *, reason=None)[source]#
New in version 4.2.0.
Sets the preferred locale of the guild.
- async set_description(description, *, reason=None)[source]#
New in version 4.2.0.
Sets the description of the guild.
New in version 4.2.0.
Sets the visibility of the premium progress bar of the guild.
- async set_splash(splash, *, reason=None)[source]#
New in version 4.2.0.
Sets the splash of the guild.
- async set_discovery_splash(discovery_splash, *, reason=None)[source]#
New in version 4.2.0.
Sets the discovery_splash of the guild.
- async set_banner(banner, *, reason=None)[source]#
New in version 4.2.0.
Sets the banner of the guild.
- async create_scheduled_event(name, entity_type, scheduled_start_time, scheduled_end_time=<interactions.MISSING>, entity_metadata=<interactions.MISSING>, channel_id=<interactions.MISSING>, description=<interactions.MISSING>, image=<interactions.MISSING>)[source]#
New in version 4.0.2.
Creates a scheduled event for the guild.
- Parameters:
name (str) – The name of the event
entity_type (EntityType) – The entity type of the scheduled event
scheduled_start_time (datetime.isoformat) – The time to schedule the scheduled event
scheduled_end_time (Optional[datetime.isoformat]) – The time when the scheduled event is scheduled to end
entity_metadata (Optional[EventMetadata]) – The entity metadata of the scheduled event
channel_id (Optional[int]) – The channel id of the scheduled event.
description (Optional[str]) – The description of the scheduled event
image (Optional[Image]) – The cover image of the scheduled event
- Returns:
The created event
- Return type:
- async get_scheduled_events(with_user_count)[source]#
New in version 4.3.2.
Gets all scheduled events of the guild.
- Parameters:
with_user_count (bool) – A boolean to include number of users subscribed to the associated event, if given.
- Returns:
The sheduled events of the guild.
- Return type:
List[ScheduledEvents]
- async modify_scheduled_event(event_id, name=<interactions.MISSING>, entity_type=<interactions.MISSING>, scheduled_start_time=<interactions.MISSING>, scheduled_end_time=<interactions.MISSING>, entity_metadata=<interactions.MISSING>, channel_id=<interactions.MISSING>, description=<interactions.MISSING>, status=<interactions.MISSING>, image=<interactions.MISSING>)[source]#
New in version 4.0.2.
Edits a scheduled event of the guild.
- Parameters:
event_id (Union[int, ScheduledEvents, Snowflake]) – The id of the event to edit
name (Optional[str]) – The name of the event
entity_type (Optional[EntityType]) – The entity type of the scheduled event
scheduled_start_time (Optional[datetime.isoformat]) – The time to schedule the scheduled event
scheduled_end_time (Optional[datetime.isoformat]) – The time when the scheduled event is scheduled to end
entity_metadata (Optional[EventMetadata]) – The entity metadata of the scheduled event
channel_id (Optional[int]) – The channel id of the scheduled event.
description (Optional[str]) – The description of the scheduled event
status (Optional[EventStatus]) – The status of the scheduled event
image (Optional[Image]) – The cover image of the scheduled event
- Returns:
The modified event
- Return type:
- async delete_scheduled_event(event_id)[source]#
New in version 4.0.2.
Deletes a scheduled event of the guild.
- Parameters:
event_id (Union[int, ScheduledEvents, Snowflake]) – The id of the event to delete
- async get_all_channels()[source]#
New in version 4.0.2.
Gets all channels of the guild as list.
- Returns:
The channels of the guild.
- Return type:
List[Channel]
- async get_all_active_threads()[source]#
New in version 4.3.0.
Gets all active threads of the guild.
- Returns:
The threads of the guild.
- Return type:
List[Thread]
- async get_all_roles()[source]#
New in version 4.0.2.
Gets all roles of the guild as list.
- Returns:
The roles of the guild.
- Return type:
List[Role]
- async modify_role_position(role_id, position, reason=None)[source]#
New in version 4.0.2.
Modifies the position of a role in the guild.
- async modify_role_positions(changes, reason=None)[source]#
New in version 4.2.0.
Modifies the positions of multiple roles in the guild.
- async get_bans(limit=1000, before=<interactions.MISSING>, after=<interactions.MISSING>)[source]#
New in version 4.0.2.
Changed in version 4.2.0: The method now gets an amount of bans as the endpoint on the Discord API has been paginated. To get all bans use the
get_all_bans()
method.Gets a list of banned users.
- Parameters:
- Returns:
List of banned users with reasons
- Return type:
- async prune(days=7, compute_prune_count=True, include_roles=<interactions.MISSING>)[source]#
New in version 4.3.2.
Begins a prune operation.
- Parameters:
days (Optional[int]) – Number of days to count, minimum 1, maximum 30. Defaults to 7.
compute_prune_count (Optional[bool]) – Whether the returned “pruned” dict contains the computed prune count or None.
include_roles (Optional[Union[List[Role], List[int], List[Snowflake], List[str]]]) – Role IDs to include, if given.
- Returns:
The number of pruned members, if compute_prune_count is not false. Otherwise returns None.
- Return type:
Optional[int]
- async get_prune_count(days=7, include_roles=<interactions.MISSING>)[source]#
New in version 4.3.2.
Returns the number of members that would be removed in a prune operation.
- async get_all_emoji()[source]#
New in version 4.2.0.
Gets all emojis of a guild.
- Returns:
All emojis of the guild
- Return type:
List[Emoji]
- async create_emoji(image, name=<interactions.MISSING>, roles=<interactions.MISSING>, reason=None)[source]#
New in version 4.2.0.
Creates an Emoji in the guild.
- async modify_emoji(emoji_id, name=<interactions.MISSING>, roles=<interactions.MISSING>, reason=None)[source]#
New in version 4.4.0.
Edits an Emoji in the guild.
- Parameters:
- Returns:
The modified emoji object
- Return type:
- async delete_emoji(emoji, reason=None)[source]#
New in version 4.2.0.
Deletes an emoji of the guild.
- async get_stickers()[source]#
New in version 4.3.2.
Get the stickers for a guild.
- Returns:
List of stickers of the guild.
- Return type:
Optional[List[Sticker]]
- async get_nitro_sticker_packs()[source]#
New in version 4.3.2.
Gets the list of sticker packs available to Nitro subscribers.
- Returns:
List of sticker packs.
- Return type:
List[StickerPack]
- async create_sticker(file, tags, name=<interactions.MISSING>, description=<interactions.MISSING>, reason=None)[source]#
New in version 4.3.2.
Creates a new sticker for the guild.
- Parameters:
- Returns:
Created sticker for the guild.
- Return type:
- async modify_sticker(sticker_id, name=<interactions.MISSING>, description=<interactions.MISSING>, reason=None)[source]#
New in version 4.3.2.
Modifies the sticker of the guild.
- Parameters:
- Returns:
Modified sticker.
- Return type:
- async delete_sticker(sticker_id, reason=None)[source]#
New in version 4.3.2.
Deletes the sticker of the guild.
- async get_list_of_members(limit=1, after=<interactions.MISSING>)[source]#
New in version 4.2.0.
Lists the members of a guild.
- async search_members(query, limit=1)[source]#
New in version 4.2.0.
Search the guild for members whose username or nickname starts with provided string.
- async get_all_members()[source]#
New in version 4.2.0.
Deprecated since version 4.3.2: Use
get_members()
instead.Gets all members of a guild.
Warning
Calling this method can lead to rate-limits in larger guilds.
- Returns:
Returns a list of all members of the guild
- Return type:
List[Member]
- get_members(start_at=<interactions.MISSING>, maximum=inf, check=None)[source]#
New in version 4.3.2.
- Parameters:
start_at (Optional[Union[int, str, Snowflake, Member]]) – The member to begin getting the members from
maximum (Optional[int]) – A set maximum of members to get before stopping the iteration
check (Optional[Callable[[Member], Union[bool, Awaitable[bool]]]]) – A custom check to ignore certain members
- Returns:
An asynchronous iterator over the members of the guild
- Return type:
- async list_auto_moderation_rules()[source]#
New in version 4.3.0.
Lists all AutoMod rules.
- Return type:
- async get_auto_moderation_rule(rule_id)[source]#
New in version 4.3.0.
Gets a AutoMod rule from its ID
- Parameters:
- Returns:
A AutoMod rule
- Return type:
- async create_auto_moderation_rule(name, trigger_type, actions, trigger_metadata=<interactions.MISSING>, enabled=False, exempt_roles=<interactions.MISSING>, exempt_channels=<interactions.MISSING>, reason=None)[source]#
New in version 4.3.0.
Creates an AutoMod rule
- Parameters:
name (str) – The name of the new rule.
trigger_type (AutoModTriggerType) – The trigger type of the new rule.
trigger_metadata (Optional[AutoModTriggerMetadata]) – The trigger metadata payload representation. This can be omitted based on the trigger type.
actions (List[AutoModAction]) – The actions that will execute when the rule is triggered.
enabled (Optional[bool]) – Whether the rule will be enabled upon creation. False by default.
exempt_roles (Optional[List[int]]) – The role IDs that are whitelisted by the rule, if given. The maximum is 20.
exempt_channels (Optional[List[int]]) – The channel IDs that are whitelisted by the rule, if given. The maximum is 20
reason (Optional[str]) – The reason of the creation
- Returns:
The new AutoMod rule
- Return type:
- async modify_auto_moderation_rule(rule, name=<interactions.MISSING>, trigger_type=<interactions.MISSING>, actions=<interactions.MISSING>, trigger_metadata=<interactions.MISSING>, enabled=<interactions.MISSING>, exempt_roles=<interactions.MISSING>, exempt_channels=<interactions.MISSING>, reason=None)[source]#
New in version 4.3.0.
Edits an AutoMod rule
- Parameters:
rule (Union[int, Snowflake, AutoModerationRule]) – The rule to modify
name (str) – The name of the new rule.
trigger_type (AutoModTriggerType) – The trigger type of the new rule.
trigger_metadata (Optional[AutoModTriggerMetadata]) – The trigger metadata payload representation. This can be omitted based on the trigger type.
actions (List[AutoModAction]) – The actions that will execute when the rule is triggered.
enabled (Optional[bool]) – Whether the rule will be enabled upon creation. False by default.
exempt_roles (Optional[List[int]]) – The role IDs that are whitelisted by the rule, if given. The maximum is 20.
exempt_channels (Optional[List[int]]) – The channel IDs that are whitelisted by the rule, if given. The maximum is 20
reason (Optional[str]) – The reason of the creation
- Returns:
The new AutoMod rule
- Return type:
- async get_audit_logs(limit=100, user_id=<interactions.MISSING>, action_type=<interactions.MISSING>, before=<interactions.MISSING>)[source]#
New in version 4.3.0.
Gets the audit logs of the guild.
- Parameters:
limit (Optional[int]) – How many entries to get, default 100
user_id (Optional[Union[User, int, Snowflake]]) – User ID snowflake. filter the log for actions made by a user.
action_type (Optional[Union[int, AuditLogEvents]]) – The Type of the audit log action.
before (Union[int, Snowflake]) – filter the log before a certain entry id.
- Returns:
The guild audit logs
- Return type:
- async get_latest_audit_log_action(of)[source]#
New in version 4.3.0.
Gets the latest audit log action of either a user or an action type
- Parameters:
of (Union[User, Snowflake, AuditLogEvents, int, Tuple[Union[User, Snowflake, int], Union[AuditLogEvents, int]]]) –
The user/user ID or action type to look for.
- Detailed description:
AuditLogEvents
or and AuditLogEvent asint
representation:- return:
The latest audit log entry of this type.
- Returns:
The latest AuditLog action that applies to the
of
parameter- Return type:
- async get_full_audit_logs(user_id=<interactions.MISSING>, action_type=<interactions.MISSING>)[source]#
New in version 4.3.0.
Gets the full audit log of the guild.
- async get_invite(invite_code, with_counts=<interactions.MISSING>, with_expiration=<interactions.MISSING>, guild_scheduled_event_id=<interactions.MISSING>)[source]#
New in version 4.3.4.
Gets the invite using its code.
- Parameters:
invite_code (str) – A string representing the invite code.
with_counts (Optional[bool]) – Whether approximate_member_count and approximate_presence_count are returned.
with_expiration (Optional[bool]) – Whether the invite’s expiration date is returned.
guild_scheduled_event_id (Optional[int]) – A guild scheduled event’s ID.
- Returns:
An invite
- Return type:
- async delete_invite(invite_code, reason=None)[source]#
New in version 4.3.4.
Deletes the invite using its code.
- async get_invites()[source]#
New in version 4.3.4.
Gets invites of the guild.
- Returns:
A list of guild invites
- Return type:
List[Invite]
- async modify_bot_nick(new_nick=<interactions.MISSING>)[source]#
New in version 4.4.0.
Changes a nickname of the current bot user in a guild.
- property icon_url: Optional[str]#
New in version 4.2.0.
Returns the URL of the guild’s icon.
- Returns:
URL of the guild’s icon (None will be returned if no icon is set)
- Return type:
- property banner_url: Optional[str]#
New in version 4.2.0.
Returns the URL of the guild’s banner.
- Returns:
URL of the guild’s banner (None will be returned if no banner is set)
- Return type:
- class interactions.api.models.guild.GuildPreview(kwargs_dict=None, /, **other_kwargs)[source]#
A class object representing the preview of a guild.
- Variables:
id (Snowflake) – The ID of the guild.
name (str) – The name of the guild.
icon (Optional[str]) – The icon of the guild.
splash (Optional[str]) – The invite splash banner of the guild.
discovery_splash (Optional[str]) – The discovery splash banner of the guild.
emojis (List[Emoji]) – The list of emojis from the guild.
features (List[GuildFeatures]) – The list of features of the guild.
approximate_member_count (int) – The approximate amount of members in the guild.
approximate_presence_count (int) – The approximate amount of presences in the guild.
description (Optional[str]) – The description of the guild.
- class interactions.api.models.guild.Invite(kwargs_dict=None, /, **other_kwargs)[source]#
The invite object.
- Variables:
uses (int) – The amount of uses on this invite.
max_uses (int) – The amount of maximum uses on this invite.
max_age (int) – The maximum age of this invite, in seconds.
temporary (bool) – A detection of whether this invite only grants temporary membership.
created_at (datetime) – The time when this invite was created.
expires_at (datetime) – The time when this invite will expire.
type (int) – The type of this invite.
inviter (User) – The user who created this invite.
code (str) – The code of this invite.
guild_id (Optional[int]) – The guild ID of this invite.
channel_id (Optional[int]) – The channel ID of this invite.
target_user_type (Optional[int]) – The type of the target user of this invite.
target_user (Optional[User]) – The target user of this invite.
target_type (Optional[int]) – The target type of this invite.
guild (Optional[Guild]) – The guild of this invite.
channel (Optional[Channel]) – The channel of this invite.
approximate_member_count (Optional[int]) – The approximate amount of total members in a guild.
approximate_presence_count (Optional[int]) – The aprpoximate amount of online members in a guild.
guild_scheduled_event (Optional[ScheduledEvents]) – A scheduled guild event object included in the invite.
- class interactions.api.models.guild.AsyncMembersIterator(_client, obj, maximum=inf, start_at=<interactions.MISSING>, check=None)[source]#
New in version 4.3.2.
A class object that allows iterating through a channel’s history.
- Parameters:
_client (HTTPClient) – The HTTPClient of the bot
obj (Union[int, str, Snowflake, Guild]) – The guild to get the members from
start_at (Optional[Union[int, str, Snowflake, Member]]) – The member ID to start getting members from (gets all members after that member)
check (Optional[Callable[[Member], Union[bool, Awaitable[bool]]]]) – A check to ignore certain members
maximum (Optional[int]) – A set maximum of members to get before stopping the iteration