Guild¶
discord_http.guild module¶
- class discord_http.guild.BanEntry(user, reason)¶
Bases:
NamedTupleRepresents a ban entry for a guild member.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class discord_http.guild.Guild(*, state, data, populate_cache=True)¶
Bases:
PartialGuildRepresents a guild (server) in Discord.
- Parameters:
state (DiscordAPI)
data (dict)
populate_cache (bool)
- async ban(member, *, delete_message_days=0, delete_message_seconds=0, reason=None) None¶
Ban a member from the server.
- async begin_guild_prune(*, days=7, compute_prune_count=True, include_roles=None, reason=None) int | None¶
Begin a guild prune.
- Parameters:
- Return type:
- Returns:
The amount of members that were pruned
- async bulk_ban(*members, delete_message_days=0, delete_message_seconds=0, reason=None) list[PartialMember]¶
Ban multiple members from the server.
- Parameters:
- Return type:
- Returns:
The banned members
- property categories: list[CategoryChannel]¶
A list of all the category channels in the guild if they are cached.
- property channels: list[BaseChannel | PartialChannel]¶
A list of all the channels in the guild if they are cached.
- async create_automod_rule(name, *, event_type, trigger_type, keyword_filter=None, regex_patterns=None, presets=None, allow_list=None, mention_total_limit=None, mention_raid_protection_enabled=False, alert_channel=None, timeout_seconds=None, message=None, enabled=True, exempt_roles=None, exempt_channels=None, reason=None) AutoModRule¶
Create an automod rule.
- Parameters:
name (
str) – Name of the automodevent_type (
AutoModRuleEventType|int) – What type of eventtrigger_type (
AutoModRuleTriggerType|int) – What should make it get triggeredregex_patterns (
list[str] |None) – Keywords in regex pattern to filterpresets (
list[AutoModRulePresetType] |None) – Automod presets to includeallow_list (
list[str] |None) – List of keywords that are allowedmention_total_limit (
int|None) – How many unique mentions allowed before triggermention_raid_protection_enabled (
bool) – If this should apply for raidsalert_channel (
Snowflake|int|None) – Where the action should be loggedtimeout_seconds (
int|None) – How many seconds the user in question should be timed outmessage (
str|None) – What message the user gets when action is takenenabled (
bool) – If the automod should be enabled or notexempt_roles (
list[Snowflake|int] |None) – Which roles are allowed to bypassexempt_channels (
list[Snowflake|int] |None) – Which channels are allowed to bypass
- Return type:
- Returns:
The automod that was just created
- async create_category(name, *, overwrites=None, position=None, reason=None) CategoryChannel¶
Create a category channel.
- Parameters:
- Return type:
- Returns:
The created category
- async create_role(name, *, permissions=None, color=None, colour=None, unicode_emoji=None, icon=None, hoist=False, mentionable=False, reason=None) Role¶
Create a role.
- Parameters:
name (
str) – The name of the rolepermissions (
Permissions|None) – The permissions of the rolecolor (
tuple[Colour|int,...] |Colour|Color|int|None) – Alias for colourcolour (
tuple[Colour|int,...] |Colour|Color|int|None) – The colour of the role. If tuple is provided, it switches to the new gradient role colours. The third value must be one of the following: - 16761760 - 11127295 - 16759788hoist (
bool) – Whether the role should be hoistedmentionable (
bool) – Whether the role should be mentionable
- Return type:
- Returns:
The created role
- async create_scheduled_event(name, *, start_time, end_time=None, channel=None, description=None, privacy_level=None, entity_type=None, external_location=None, image=None, recurrence_rule=None, reason=None) ScheduledEvent¶
Create a scheduled event.
- Parameters:
name (
str) – The name of the eventstart_time (
datetime|timedelta|int) – The start time of the eventend_time (
datetime|timedelta|int|None) – The end time of the eventchannel (
PartialChannel|int|None) – The channel of the eventprivacy_level (
PrivacyLevelType|None) – The privacy level of the event (default is guild_only)entity_type (
ScheduledEventEntityType|None) – The entity type of the event (default is voice)external_location (
str|None) – The external location of the eventrecurrence_rule (
ScheduledEventRecurrenceRule|None) – The recurrence rule of the event, to make it a recurring event
- Return type:
- Returns:
The created event
- async create_soundboard_sound(name, *, sound, volume=None, emoji_id=None, emoji_name=None, reason=None) SoundboardSound¶
Create a soundboard sound.
- Parameters:
name (
str) – Name of the soundboard soundsound (
File|bytes) – File object to create a soundboard sound fromemoji_name (
str|None) – The unicode emoji of the soundboard soundemoji_id (
str|None) – The ID of the custom emoji of the soundboard soundreason (
str|None) – The reason for creating the soundboard sound
- Return type:
- Returns:
The created soundboard sound
- Raises:
ValueError – If both emoji_name and emoji_id are set
- async create_stage_channel(name, *, bitrate=None, user_limit=None, overwrites=None, position=None, parent_id=None, video_quality_mode=None, reason=None) StageChannel¶
Create a stage channel.
- Parameters:
name (
str) – The name of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryvideo_quality_mode (
VideoQualityType|int|None) – The video quality mode of the channelparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the stage channel
- Return type:
- Returns:
The created channel
- async create_template(name, *, description=None) GuildTemplate¶
Creates a template based on the guild’s current state.
Requires the MANAGE_GUILD permission.
- Parameters:
- Return type:
- Returns:
The created template
- async create_text_channel(name, *, topic=None, position=None, rate_limit_per_user=None, overwrites=None, parent_id=None, nsfw=None, reason=None) TextChannel¶
Create a text channel.
- Parameters:
name (
str) – The name of the channelrate_limit_per_user (
int|None) – The rate limit per user of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the text channel
- Return type:
- Returns:
The created channel
- async create_voice_channel(name, *, bitrate=None, user_limit=None, rate_limit_per_user=None, overwrites=None, position=None, video_quality_mode=None, parent_id=None, nsfw=None, reason=None) VoiceChannel¶
Create a voice channel.
- Parameters:
name (
str) – The name of the channelrate_limit_per_user (
int|None) – The rate limit per user of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryvideo_quality_mode (
VideoQualityType|int|None) – The video quality mode of the channelparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the voice channel
- Return type:
- Returns:
The created channel
- async edit(*, name=<MISSING>, verification_level=<MISSING>, default_message_notifications=<MISSING>, explicit_content_filter=<MISSING>, afk_channel_id=<MISSING>, afk_timeout=<MISSING>, icon=<MISSING>, owner_id=<MISSING>, splash=<MISSING>, discovery_splash=<MISSING>, banner=<MISSING>, system_channel_id=<MISSING>, system_channel_flags=<MISSING>, rules_channel_id=<MISSING>, public_updates_channel_id=<MISSING>, preferred_locale=<MISSING>, description=<MISSING>, features=<MISSING>, premium_progress_bar_enabled=<MISSING>, safety_alerts_channel_id=<MISSING>, reason=None) PartialGuild¶
Edit the guild.
- Parameters:
verification_level (
VerificationLevel|None) – Verification level of the guilddefault_message_notifications (
DefaultNotificationLevel|None) – Default message notification level of the guildexplicit_content_filter (
ContentFilterLevel|None) – Explicit content filter level of the guildafk_channel_id (
VoiceChannel|PartialChannel|int|None) – AFK channel of the guildowner_id (
Member|PartialMember|int|None) – Owner of the guilddiscovery_splash (
File|None) – Discovery splash of the guildsystem_channel_id (
TextChannel|PartialChannel|int|None) – System channel of the guildsystem_channel_flags (
SystemChannelFlags|None) – System channel flags of the guildrules_channel_id (
TextChannel|PartialChannel|int|None) – Rules channel of the guildpublic_updates_channel_id (
TextChannel|PartialChannel|int|None) – Public updates channel of the guildpreferred_locale (
str|None) – Preferred locale of the guildpremium_progress_bar_enabled (
bool|None) – Whether the premium progress bar is enabledsafety_alerts_channel_id (
TextChannel|PartialChannel|int|None) – Safety alerts channel of the guild
- Return type:
- Returns:
The edited guild
- async edit_incident_actions(*, invites_disabled_until=<MISSING>, dms_disabled_until=<MISSING>) GuildIncidentsData¶
Edits the guild’s security incident actions.
Requires the MANAGE_GUILD permission.
- Parameters:
invites_disabled_until (
datetime|timedelta|int|None) – When invites should be re-enabled, or None to re-enable them immediately. Can only be up to 24 hours in the future.dms_disabled_until (
datetime|timedelta|int|None) – When direct messages should be re-enabled, or None to re-enable them immediately. Can only be up to 24 hours in the future.
- Return type:
- Returns:
The updated security incident actions
- async edit_onboarding(*, prompts=<MISSING>, default_channel_ids=<MISSING>, enabled=<MISSING>, mode=<MISSING>, reason=None) GuildOnboarding¶
Edits the guild’s onboarding configuration.
Requires the MANAGE_GUILD and MANAGE_ROLES permissions.
- Parameters:
prompts (
list[OnboardingPrompt] |None) – New prompts shown during onboarding and in the Channels & Roles tabdefault_channel_ids (
list[Snowflake|int] |None) – New channel IDs that members get opted into automaticallyenabled (
bool|None) – Whether onboarding should be enabledmode (
OnboardingMode|int|None) – New constraint mode used for onboardingreason (
str|None) – The reason for editing the onboarding configuration
- Return type:
- Returns:
The edited onboarding configuration
- async edit_welcome_screen(*, enabled=<MISSING>, description=<MISSING>, welcome_channels=<MISSING>, reason=None) WelcomeScreen¶
Edits the guild’s welcome screen.
Requires the MANAGE_GUILD permission.
- Parameters:
- Return type:
- Returns:
The edited welcome screen
- async edit_widget(*, enabled=<MISSING>, channel=<MISSING>, reason=None) GuildWidgetSettings¶
Edits the guild’s widget settings.
Requires the MANAGE_GUILD permission.
- Parameters:
enabled (
bool|None) – Whether the widget should be enabledchannel (
BaseChannel|PartialChannel|int|None) – The channel the widget invite should point to
- Return type:
- Returns:
The edited widget settings
- property emojis: list[Emoji | PartialEmoji]¶
A list of all the emojis in the guild if they are cached.
- async fetch_audit_logs(*, before=None, after=None, user=None, action=None, limit=100) AsyncIterator[AuditLogEntry]¶
Fetches the audit logs for the guild.
- Parameters:
before (
datetime|AuditLogEntry|Snowflake|int|None) – Consider only entries before given entryafter (
datetime|AuditLogEntry|Snowflake|int|None) – Consider only entries after given entryuser (
Snowflake|int|None) – Consider only entries made by given useraction (
AuditLogType|None) – Consider only entries with given actionlimit (
int|None) – The maximum amount of messages to fetch.
- Return type:
- Returns:
The audit logs for the guild
- async fetch_automod_rule(automod_id) AutoModRule¶
Fetches a automod rule from the guild.
- Return type:
- Parameters:
automod_id (int)
- async fetch_automod_rules() list[AutoModRule]¶
Fetches all the automod rules in the guild.
- Return type:
- async fetch_bans(*, before=None, after=None, limit=1000) AsyncIterator[BanEntry]¶
Fetch the bans of the guild.
- Parameters:
- Yields:
The message object
- Return type:
- async fetch_channel(channel_id) BaseChannel¶
Fetch a channel from the guild.
- Parameters:
channel_id (
int) – The ID of the channel- Return type:
- Returns:
The channel object
- async fetch_channels() list[type[BaseChannel]]¶
Fetches all the channels in the guild.
- Return type:
- async fetch_guild_prune_count(*, days=7, include_roles=None) int¶
Fetch the amount of members that would be pruned.
- async fetch_integrations() list[Integration]¶
Fetches the integrations for the guild.
This requires the MANAGE_GUILD permission.
- Return type:
- Returns:
The integrations in the guild.
- async fetch_members(*, limit=1000, after=None) AsyncIterator[Member]¶
Fetches all the members in the guild.
- async fetch_onboarding() GuildOnboarding¶
Fetches the guild’s onboarding configuration.
- Return type:
- async fetch_preview() GuildPreview¶
Fetches a preview of the guild, including for guilds the bot may not be in if discoverable.
- Return type:
- async fetch_public_threads() list[PublicThread]¶
Fetches all the public threads in the guild.
- Return type:
- Returns:
The public threads in the guild
- async fetch_regions() list[VoiceRegion]¶
Fetches all the voice regions for the guild.
- Return type:
- async fetch_scheduled_event(id) ScheduledEvent¶
Fetches a scheduled event object.
- Parameters:
id (
int) – The ID of the scheduled event.- Return type:
- Returns:
The scheduled event object.
- async fetch_scheduled_events_list() list[ScheduledEvent]¶
Fetches all the scheduled events in the guild.
- Return type:
- async fetch_soundboard_sound(sound_id) SoundboardSound¶
Fetches a soundboard sound from the guild.
- Return type:
- Parameters:
sound_id (int)
- async fetch_soundboard_sounds() list[SoundboardSound]¶
Fetches all the soundboard sounds in the guild.
- Return type:
- async fetch_templates() list[GuildTemplate]¶
Fetches the templates for the guild. Requires the MANAGE_GUILD permission.
- Return type:
- async fetch_welcome_screen() WelcomeScreen¶
Fetches the guild’s welcome screen.
- Return type:
- async fetch_widget() GuildWidget¶
Fetches the guild’s public widget. Requires no permissions or authentication.
- Return type:
- async fetch_widget_settings() GuildWidgetSettings¶
Fetches the guild’s widget settings. Requires the MANAGE_GUILD permission.
- Return type:
- get_channel(channel_id) BaseChannel | PartialChannel | None¶
Returns the channel from cache if it exists.
- Parameters:
channel_id (
int) – The ID of the channel to get.- Return type:
- Returns:
The channel with the given ID, if it exists.
- get_channel_voice_states(channel_id) list[VoiceState | PartialVoiceState]¶
Returns the voice state of a channel.
- Parameters:
channel_id (
int) – The ID of the channel to get the voice state of.- Return type:
- Returns:
The voice state of the channel
- get_member(member_id) Member | PartialMember | None¶
Returns the member from cache if it exists.
- Parameters:
member_id (
int) – The ID of the member to get.- Return type:
Member|PartialMember|None- Returns:
The member with the given ID, if it exists.
- get_member_voice_state(member_id) VoiceState | PartialVoiceState | None¶
Returns the voice state of a member from cache if it exists.
- Parameters:
member_id (
int) – The ID of the member to get the voice state of.- Return type:
- Returns:
The voice state of the member, if it exists.
- get_partial_automod_rule(automod_id) PartialAutoModRule¶
Returns a partial automod rule object.
- Return type:
- Parameters:
automod_id (int)
- get_partial_channel(channel_id) PartialChannel¶
Get a partial channel object.
- Parameters:
channel_id (
int) – The ID of the channel- Return type:
- Returns:
The partial channel object
- get_partial_emoji(emoji_id) PartialEmoji¶
Get a partial emoji object.
- Parameters:
emoji_id (
int) – The ID of the emoji- Return type:
- Returns:
The partial emoji object
- get_partial_member(member_id) PartialMember¶
Get a partial member object.
- Parameters:
member_id (
int) – The ID of the member- Return type:
- Returns:
The partial member object
- get_partial_role(role_id) PartialRole¶
Get a partial role object.
- Parameters:
role_id (
int) – The ID of the role- Return type:
- Returns:
The partial role object
- get_partial_scheduled_event(id) PartialScheduledEvent¶
Creates a partial scheduled event object.
- Parameters:
id (
int) – The ID of the scheduled event.- Return type:
- Returns:
The partial scheduled event object.
- get_partial_soundboard_sound(sound_id) PartialSoundboardSound¶
Get a partial soundboard sound object.
- Parameters:
sound_id (
int) – The ID of the sound- Return type:
- Returns:
The partial soundboard sound object
- get_partial_sticker(sticker_id) PartialSticker¶
Get a partial sticker object.
- Parameters:
sticker_id (
int) – The ID of the sticker- Return type:
- Returns:
The partial sticker object
- get_partial_template(code) PartialGuildTemplate¶
Creates a partial template object under this guild, without fetching it.
- Return type:
- Parameters:
code (str)
- get_soundboard_sound(sound_id) SoundboardSound | PartialSoundboardSound | None¶
Returns the soundboard sound from cache if it exists.
- Parameters:
sound_id (
int) – The ID of the soundboard sound to get.- Return type:
- Returns:
The soundboard sound with the given ID, if it exists.
- get_thread(thread_id) BaseChannel | PartialChannel | None¶
Returns the thread from cache if it exists.
- Parameters:
thread_id (
int) – The ID of the thread to get.- Return type:
- Returns:
The thread with the given ID, if it exists.
- get_voice_states() list[VoiceState | PartialVoiceState]¶
Returns the voice state of the guild.
- Return type:
- property me: Member | PartialMember | None¶
The bot’s member object.
Only useable if you are using gateway and caching
- property members: list[Member | PartialMember]¶
A list of all the members in the guild if they are cached.
- property roles: list[Role | PartialRole]¶
A list of all the roles in the guild if they are cached or if the guild was fetched.
- async search_messages(*, query=None, limit=25, offset=0, max_id=None, min_id=None, slop=None, channel_id=None, author_type=None, author_id=None, mentions=None, mentions_role_id=None, mention_everyone=None, replied_to_user_id=None, replied_to_message_id=None, pinned=None, has=None, embed_type=None, embed_provider=None, link_hostname=None, attachment_filename=None, attachment_extension=None, sort_by='timestamp', sort_order='desc', include_nsfw=None) AsyncIterator[Message]¶
Search for messages within the guild.
- Parameters:
query (
str|None) – The content to search for (max 1024 characters).limit (
int|None) – The maximum amount of messages to yield.offset (
int) – Number of messages to skip (max 9975).max_id (
Snowflake|int|None) – Get messages before this message ID.min_id (
Snowflake|int|None) – Get messages after this message ID.slop (
int|None) – The max number of words to skip between matching tokens in the search (default 2, max 100).channel_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages by these channels (max 500).author_type (
Union[list[Literal['user','bot','webhook','-user','-bot','-webhook']],Literal['user','bot','webhook','-user','-bot','-webhook'],None]) – Filter messages by author type (e.g. ‘user’, ‘bot’, ‘webhook’). Negate with ‘-‘.author_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages by these authors (max 100).mentions (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that mention these users (max 100).mentions_role_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that mention these roles (max 100).mention_everyone (
bool|None) – Filter messages that do or do not mention @everyone.replied_to_user_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that reply to these users (max 100).replied_to_message_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that reply to these messages (max 100).pinned (
bool|None) – Filter messages by whether they are or are not pinned.has (
Union[list[Literal['image','sound','video','file','sticker','embed','link','poll','snapshot','-image','-sound','-video','-file','-sticker','-embed','-link','-poll','-snapshot']],Literal['image','sound','video','file','sticker','embed','link','poll','snapshot','-image','-sound','-video','-file','-sticker','-embed','-link','-poll','-snapshot'],None]) – Filter messages by whether or not they have specific things (e.g. ‘image’, ‘embed’).embed_type (
Union[list[Literal['image','video','gif','sound','article']],Literal['image','video','gif','sound','article'],None]) – Filter messages by embed type (e.g. ‘image’, ‘video’).embed_provider (
list[str] |str|None) – Filter messages by embed provider (case-sensitive, e.g. ‘Tenor’) (max 100).link_hostname (
list[str] |str|None) – Filter messages by link hostname (e.g. ‘discord.com’) (max 100).attachment_filename (
list[str] |str|None) – Filter messages by attachment filename (max 100).attachment_extension (
list[str] |str|None) – Filter messages by attachment extension (e.g. ‘txt’) (max 100).sort_by (
Literal['timestamp','relevance']) – The sorting algorithm to use (“timestamp” or “relevance”).sort_order (
Literal['asc','desc']) – The direction to sort (“asc” or “desc”).include_nsfw (
bool|None) – Whether to include results from age-restricted channels (default False).
- Yields:
The message object matching the search.
- Return type:
- property soundboard_sounds: list[SoundboardSound | PartialSoundboardSound]¶
A list of all the soundboard sounds in the guild if they are cached.
- property stickers: list[Sticker | PartialSticker]¶
A list of all the stickers in the guild if they are cached.
- property text_channels: list[TextChannel]¶
A list of all the text channels in the guild if they are cached.
- property threads: list[BaseChannel | PartialChannel]¶
A list of all the threads in the guild if they are cached.
Whether the guild is unavailable or not. This can be true during outages or when the bot is not a member of the guild.
- property voice_channels: list[VoiceChannel]¶
A list of all the voice channels in the guild if they are cached.
- widget_image_url(*, style='shield') str¶
Returns the URL for the guild’s widget image (PNG).
Requires no permissions or authentication to access.
- approximate_member_count: int | None¶
The approximate number of members in the guild, only available when fetched with with_counts.
- approximate_presence_count: int | None¶
The approximate number of non-offline members in the guild, only available when fetched with with_counts.
Whether the premium progress bar is enabled.
The number of premium subscriptions in the guild.
The premium tier of the guild.
- verification_level: VerificationLevel¶
The verification level of the guild.
- incidents_data: GuildIncidentsData | None¶
The security incident actions taken on the guild, if any.
- welcome_screen: WelcomeScreen | None¶
The welcome screen of the guild, if it’s a Community guild and this was returned in an Invite’s guild object.
- property owner: Member | PartialMember | None¶
The owner of the guild, if any.
- property afk_channel: BaseChannel | PartialChannel | None¶
The AFK channel of the guild, if any.
- property system_channel: BaseChannel | PartialChannel | None¶
The system channel of the guild, if any.
- property public_updates_channel: BaseChannel | PartialChannel | None¶
The public updates channel of the guild, if any.
- property safety_alerts_channel: BaseChannel | PartialChannel | None¶
The safety alerts channel of the guild, if any.
- property widget_channel: BaseChannel | PartialChannel | None¶
The widget channel of the guild, if any.
- property discovery_splash: Asset | None¶
The guild’s discovery splash, only present for guilds with the DISCOVERABLE feature.
The guild’s premium subscriber role if available.
- get_role(role_id) Role | None¶
Get a role from the guild.
This simply returns the role from the role list in this object if it exists
- class discord_http.guild.GuildIncidentsData(invites_disabled_until, dms_disabled_until, dm_spam_detected_at, raid_detected_at)¶
Bases:
NamedTupleRepresents the security incident actions taken on a guild.
- Parameters:
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class discord_http.guild.GuildOnboarding(*, state, data)¶
Bases:
objectRepresents a guild’s onboarding configuration.
- Parameters:
state (DiscordAPI)
data (dict)
- prompts: list[OnboardingPrompt]¶
The prompts shown during onboarding and in the Channels & Roles tab.
- mode: OnboardingMode¶
The constraint mode used for onboarding.
- class discord_http.guild.GuildPreview(*, state, data)¶
Bases:
PartialBaseRepresents a preview of a guild, including ones the bot may not be in.
- Parameters:
state (DiscordAPI)
data (dict)
- class discord_http.guild.GuildTemplate(*, state, data)¶
Bases:
PartialGuildTemplateRepresents a guild template object.
- Parameters:
state (DiscordAPI)
data (dict)
- serialized_source_guild: dict¶
The raw guild snapshot this template contains.
This is not a real Guild object, placeholder IDs in it are given as plain integers.
- property source_guild: Guild | PartialGuild¶
The guild this template is based on.
- async edit(*, name=<MISSING>, description=<MISSING>) GuildTemplate¶
Edits the template’s metadata.
- Parameters:
- Return type:
- Returns:
The edited template
- async fetch() GuildTemplate¶
Fetches the guild template.
- Return type:
- async sync() GuildTemplate¶
Syncs the template to the guild’s current state.
- Return type:
- class discord_http.guild.GuildWidget(*, state, data)¶
Bases:
objectRepresents a guild’s public widget.
- Parameters:
state (DiscordAPI)
data (dict)
- channels: list[GuildWidgetChannel]¶
The voice/stage channels accessible by @everyone.
- members: list[GuildWidgetMember]¶
The anonymized members currently visible in the widget (up to 100).
- class discord_http.guild.GuildWidgetChannel(*, state, guild_id, data)¶
Bases:
objectRepresents a channel shown in a guild’s widget.
- Parameters:
state (DiscordAPI)
guild_id (int)
data (dict)
- property channel: PartialChannel¶
The channel shown in the widget.
- channel_id¶
- class discord_http.guild.GuildWidgetMember(id, username, status, avatar_url)¶
Bases:
NamedTupleRepresents an anonymized member shown in a guild’s widget. This does not correspond to a real user.
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class discord_http.guild.GuildWidgetSettings(*, state, guild_id, data)¶
Bases:
objectRepresents a guild’s widget settings.
- Parameters:
state (DiscordAPI)
guild_id (int)
data (dict)
- property channel: PartialChannel | None¶
The channel the widget invite points to, if any.
- class discord_http.guild.OnboardingPrompt(*, state, data)¶
Bases:
PartialBaseRepresents a prompt within a guild’s onboarding flow.
- Parameters:
state (DiscordAPI)
data (dict)
- options: list[OnboardingPromptOption]¶
The options available within the prompt.
- type: OnboardingPromptType¶
The type of the prompt.
- in_onboarding: bool¶
Whether the prompt is present in the onboarding flow, rather than only the Channels & Roles tab.
- class discord_http.guild.OnboardingPromptOption(*, state, data)¶
Bases:
PartialBaseRepresents an option within a guild onboarding prompt.
- Parameters:
state (DiscordAPI)
data (dict)
- emoji: EmojiParser | None¶
The emoji associated with the prompt option.
- class discord_http.guild.PartialGuild(*, state, id)¶
Bases:
PartialBaseRepresents a partial guild object.
- Parameters:
state (DiscordAPI)
id (int)
Whether the guild is unavailable or not. This can be true during outages or when the bot is not a member of the guild.
- property me: Member | PartialMember | None¶
The bot’s member object.
Only useable if you are using gateway and caching
- get_member(member_id) Member | PartialMember | None¶
Returns the member from cache if it exists.
- Parameters:
member_id (
int) – The ID of the member to get.- Return type:
Member|PartialMember|None- Returns:
The member with the given ID, if it exists.
- get_channel(channel_id) BaseChannel | PartialChannel | None¶
Returns the channel from cache if it exists.
- Parameters:
channel_id (
int) – The ID of the channel to get.- Return type:
- Returns:
The channel with the given ID, if it exists.
- get_thread(thread_id) BaseChannel | PartialChannel | None¶
Returns the thread from cache if it exists.
- Parameters:
thread_id (
int) – The ID of the thread to get.- Return type:
- Returns:
The thread with the given ID, if it exists.
- get_voice_states() list[VoiceState | PartialVoiceState]¶
Returns the voice state of the guild.
- Return type:
- get_channel_voice_states(channel_id) list[VoiceState | PartialVoiceState]¶
Returns the voice state of a channel.
- Parameters:
channel_id (
int) – The ID of the channel to get the voice state of.- Return type:
- Returns:
The voice state of the channel
- get_member_voice_state(member_id) VoiceState | PartialVoiceState | None¶
Returns the voice state of a member from cache if it exists.
- Parameters:
member_id (
int) – The ID of the member to get the voice state of.- Return type:
- Returns:
The voice state of the member, if it exists.
- get_role(role_id) Role | PartialRole | None¶
Returns the role from cache if it exists.
- Parameters:
role_id (
int) – The ID of the role to get.- Return type:
Role|PartialRole|None- Returns:
The role with the given ID, if it exists.
- get_soundboard_sound(sound_id) SoundboardSound | PartialSoundboardSound | None¶
Returns the soundboard sound from cache if it exists.
- Parameters:
sound_id (
int) – The ID of the soundboard sound to get.- Return type:
- Returns:
The soundboard sound with the given ID, if it exists.
- property members: list[Member | PartialMember]¶
A list of all the members in the guild if they are cached.
- property channels: list[BaseChannel | PartialChannel]¶
A list of all the channels in the guild if they are cached.
- property threads: list[BaseChannel | PartialChannel]¶
A list of all the threads in the guild if they are cached.
- property roles: list[Role | PartialRole]¶
A list of all the roles in the guild if they are cached or if the guild was fetched.
- property emojis: list[Emoji | PartialEmoji]¶
A list of all the emojis in the guild if they are cached.
- property soundboard_sounds: list[SoundboardSound | PartialSoundboardSound]¶
A list of all the soundboard sounds in the guild if they are cached.
- property stickers: list[Sticker | PartialSticker]¶
A list of all the stickers in the guild if they are cached.
- property text_channels: list[TextChannel]¶
A list of all the text channels in the guild if they are cached.
- property voice_channels: list[VoiceChannel]¶
A list of all the voice channels in the guild if they are cached.
- property categories: list[CategoryChannel]¶
A list of all the category channels in the guild if they are cached.
- property default_role: PartialRole¶
The default role, but as a partial role object.
- async fetch_preview() GuildPreview¶
Fetches a preview of the guild, including for guilds the bot may not be in if discoverable.
- Return type:
- async edit_incident_actions(*, invites_disabled_until=<MISSING>, dms_disabled_until=<MISSING>) GuildIncidentsData¶
Edits the guild’s security incident actions.
Requires the MANAGE_GUILD permission.
- Parameters:
invites_disabled_until (
datetime|timedelta|int|None) – When invites should be re-enabled, or None to re-enable them immediately. Can only be up to 24 hours in the future.dms_disabled_until (
datetime|timedelta|int|None) – When direct messages should be re-enabled, or None to re-enable them immediately. Can only be up to 24 hours in the future.
- Return type:
- Returns:
The updated security incident actions
- async fetch_templates() list[GuildTemplate]¶
Fetches the templates for the guild. Requires the MANAGE_GUILD permission.
- Return type:
- async create_template(name, *, description=None) GuildTemplate¶
Creates a template based on the guild’s current state.
Requires the MANAGE_GUILD permission.
- Parameters:
- Return type:
- Returns:
The created template
- get_partial_template(code) PartialGuildTemplate¶
Creates a partial template object under this guild, without fetching it.
- Return type:
- Parameters:
code (str)
- async fetch_welcome_screen() WelcomeScreen¶
Fetches the guild’s welcome screen.
- Return type:
- async edit_welcome_screen(*, enabled=<MISSING>, description=<MISSING>, welcome_channels=<MISSING>, reason=None) WelcomeScreen¶
Edits the guild’s welcome screen.
Requires the MANAGE_GUILD permission.
- Parameters:
- Return type:
- Returns:
The edited welcome screen
- async fetch_widget_settings() GuildWidgetSettings¶
Fetches the guild’s widget settings. Requires the MANAGE_GUILD permission.
- Return type:
- async edit_widget(*, enabled=<MISSING>, channel=<MISSING>, reason=None) GuildWidgetSettings¶
Edits the guild’s widget settings.
Requires the MANAGE_GUILD permission.
- Parameters:
enabled (
bool|None) – Whether the widget should be enabledchannel (
BaseChannel|PartialChannel|int|None) – The channel the widget invite should point to
- Return type:
- Returns:
The edited widget settings
- async fetch_widget() GuildWidget¶
Fetches the guild’s public widget. Requires no permissions or authentication.
- Return type:
- widget_image_url(*, style='shield') str¶
Returns the URL for the guild’s widget image (PNG).
Requires no permissions or authentication to access.
- async fetch_onboarding() GuildOnboarding¶
Fetches the guild’s onboarding configuration.
- Return type:
- async edit_onboarding(*, prompts=<MISSING>, default_channel_ids=<MISSING>, enabled=<MISSING>, mode=<MISSING>, reason=None) GuildOnboarding¶
Edits the guild’s onboarding configuration.
Requires the MANAGE_GUILD and MANAGE_ROLES permissions.
- Parameters:
prompts (
list[OnboardingPrompt] |None) – New prompts shown during onboarding and in the Channels & Roles tabdefault_channel_ids (
list[Snowflake|int] |None) – New channel IDs that members get opted into automaticallyenabled (
bool|None) – Whether onboarding should be enabledmode (
OnboardingMode|int|None) – New constraint mode used for onboardingreason (
str|None) – The reason for editing the onboarding configuration
- Return type:
- Returns:
The edited onboarding configuration
- get_partial_automod_rule(automod_id) PartialAutoModRule¶
Returns a partial automod rule object.
- Return type:
- Parameters:
automod_id (int)
- async search_messages(*, query=None, limit=25, offset=0, max_id=None, min_id=None, slop=None, channel_id=None, author_type=None, author_id=None, mentions=None, mentions_role_id=None, mention_everyone=None, replied_to_user_id=None, replied_to_message_id=None, pinned=None, has=None, embed_type=None, embed_provider=None, link_hostname=None, attachment_filename=None, attachment_extension=None, sort_by='timestamp', sort_order='desc', include_nsfw=None) AsyncIterator[Message]¶
Search for messages within the guild.
- Parameters:
query (
str|None) – The content to search for (max 1024 characters).limit (
int|None) – The maximum amount of messages to yield.offset (
int) – Number of messages to skip (max 9975).max_id (
Snowflake|int|None) – Get messages before this message ID.min_id (
Snowflake|int|None) – Get messages after this message ID.slop (
int|None) – The max number of words to skip between matching tokens in the search (default 2, max 100).channel_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages by these channels (max 500).author_type (
Union[list[Literal['user','bot','webhook','-user','-bot','-webhook']],Literal['user','bot','webhook','-user','-bot','-webhook'],None]) – Filter messages by author type (e.g. ‘user’, ‘bot’, ‘webhook’). Negate with ‘-‘.author_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages by these authors (max 100).mentions (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that mention these users (max 100).mentions_role_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that mention these roles (max 100).mention_everyone (
bool|None) – Filter messages that do or do not mention @everyone.replied_to_user_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that reply to these users (max 100).replied_to_message_id (
list[Snowflake|int] |Snowflake|int|None) – Filter messages that reply to these messages (max 100).pinned (
bool|None) – Filter messages by whether they are or are not pinned.has (
Union[list[Literal['image','sound','video','file','sticker','embed','link','poll','snapshot','-image','-sound','-video','-file','-sticker','-embed','-link','-poll','-snapshot']],Literal['image','sound','video','file','sticker','embed','link','poll','snapshot','-image','-sound','-video','-file','-sticker','-embed','-link','-poll','-snapshot'],None]) – Filter messages by whether or not they have specific things (e.g. ‘image’, ‘embed’).embed_type (
Union[list[Literal['image','video','gif','sound','article']],Literal['image','video','gif','sound','article'],None]) – Filter messages by embed type (e.g. ‘image’, ‘video’).embed_provider (
list[str] |str|None) – Filter messages by embed provider (case-sensitive, e.g. ‘Tenor’) (max 100).link_hostname (
list[str] |str|None) – Filter messages by link hostname (e.g. ‘discord.com’) (max 100).attachment_filename (
list[str] |str|None) – Filter messages by attachment filename (max 100).attachment_extension (
list[str] |str|None) – Filter messages by attachment extension (e.g. ‘txt’) (max 100).sort_by (
Literal['timestamp','relevance']) – The sorting algorithm to use (“timestamp” or “relevance”).sort_order (
Literal['asc','desc']) – The direction to sort (“asc” or “desc”).include_nsfw (
bool|None) – Whether to include results from age-restricted channels (default False).
- Yields:
The message object matching the search.
- Return type:
- async fetch_automod_rule(automod_id) AutoModRule¶
Fetches a automod rule from the guild.
- Return type:
- Parameters:
automod_id (int)
- async fetch_automod_rules() list[AutoModRule]¶
Fetches all the automod rules in the guild.
- Return type:
- async create_automod_rule(name, *, event_type, trigger_type, keyword_filter=None, regex_patterns=None, presets=None, allow_list=None, mention_total_limit=None, mention_raid_protection_enabled=False, alert_channel=None, timeout_seconds=None, message=None, enabled=True, exempt_roles=None, exempt_channels=None, reason=None) AutoModRule¶
Create an automod rule.
- Parameters:
name (
str) – Name of the automodevent_type (
AutoModRuleEventType|int) – What type of eventtrigger_type (
AutoModRuleTriggerType|int) – What should make it get triggeredregex_patterns (
list[str] |None) – Keywords in regex pattern to filterpresets (
list[AutoModRulePresetType] |None) – Automod presets to includeallow_list (
list[str] |None) – List of keywords that are allowedmention_total_limit (
int|None) – How many unique mentions allowed before triggermention_raid_protection_enabled (
bool) – If this should apply for raidsalert_channel (
Snowflake|int|None) – Where the action should be loggedtimeout_seconds (
int|None) – How many seconds the user in question should be timed outmessage (
str|None) – What message the user gets when action is takenenabled (
bool) – If the automod should be enabled or notexempt_roles (
list[Snowflake|int] |None) – Which roles are allowed to bypassexempt_channels (
list[Snowflake|int] |None) – Which channels are allowed to bypass
- Return type:
- Returns:
The automod that was just created
- async fetch_scheduled_events_list() list[ScheduledEvent]¶
Fetches all the scheduled events in the guild.
- Return type:
- async fetch_soundboard_sounds() list[SoundboardSound]¶
Fetches all the soundboard sounds in the guild.
- Return type:
- async fetch_bans(*, before=None, after=None, limit=1000) AsyncIterator[BanEntry]¶
Fetch the bans of the guild.
- Parameters:
- Yields:
The message object
- Return type:
- async create_role(name, *, permissions=None, color=None, colour=None, unicode_emoji=None, icon=None, hoist=False, mentionable=False, reason=None) Role¶
Create a role.
- Parameters:
name (
str) – The name of the rolepermissions (
Permissions|None) – The permissions of the rolecolor (
tuple[Colour|int,...] |Colour|Color|int|None) – Alias for colourcolour (
tuple[Colour|int,...] |Colour|Color|int|None) – The colour of the role. If tuple is provided, it switches to the new gradient role colours. The third value must be one of the following: - 16761760 - 11127295 - 16759788hoist (
bool) – Whether the role should be hoistedmentionable (
bool) – Whether the role should be mentionable
- Return type:
- Returns:
The created role
- async create_scheduled_event(name, *, start_time, end_time=None, channel=None, description=None, privacy_level=None, entity_type=None, external_location=None, image=None, recurrence_rule=None, reason=None) ScheduledEvent¶
Create a scheduled event.
- Parameters:
name (
str) – The name of the eventstart_time (
datetime|timedelta|int) – The start time of the eventend_time (
datetime|timedelta|int|None) – The end time of the eventchannel (
PartialChannel|int|None) – The channel of the eventprivacy_level (
PrivacyLevelType|None) – The privacy level of the event (default is guild_only)entity_type (
ScheduledEventEntityType|None) – The entity type of the event (default is voice)external_location (
str|None) – The external location of the eventrecurrence_rule (
ScheduledEventRecurrenceRule|None) – The recurrence rule of the event, to make it a recurring event
- Return type:
- Returns:
The created event
- async create_category(name, *, overwrites=None, position=None, reason=None) CategoryChannel¶
Create a category channel.
- Parameters:
- Return type:
- Returns:
The created category
- async create_text_channel(name, *, topic=None, position=None, rate_limit_per_user=None, overwrites=None, parent_id=None, nsfw=None, reason=None) TextChannel¶
Create a text channel.
- Parameters:
name (
str) – The name of the channelrate_limit_per_user (
int|None) – The rate limit per user of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the text channel
- Return type:
- Returns:
The created channel
- async create_voice_channel(name, *, bitrate=None, user_limit=None, rate_limit_per_user=None, overwrites=None, position=None, video_quality_mode=None, parent_id=None, nsfw=None, reason=None) VoiceChannel¶
Create a voice channel.
- Parameters:
name (
str) – The name of the channelrate_limit_per_user (
int|None) – The rate limit per user of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryvideo_quality_mode (
VideoQualityType|int|None) – The video quality mode of the channelparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the voice channel
- Return type:
- Returns:
The created channel
- async create_stage_channel(name, *, bitrate=None, user_limit=None, overwrites=None, position=None, parent_id=None, video_quality_mode=None, reason=None) StageChannel¶
Create a stage channel.
- Parameters:
name (
str) – The name of the channeloverwrites (
list[PermissionOverwrite] |None) – The permission overwrites of the categoryvideo_quality_mode (
VideoQualityType|int|None) – The video quality mode of the channelparent_id (
Snowflake|int|None) – The Category ID where the channel will be placedreason (
str|None) – The reason for creating the stage channel
- Return type:
- Returns:
The created channel
- async create_soundboard_sound(name, *, sound, volume=None, emoji_id=None, emoji_name=None, reason=None) SoundboardSound¶
Create a soundboard sound.
- Parameters:
name (
str) – Name of the soundboard soundsound (
File|bytes) – File object to create a soundboard sound fromemoji_name (
str|None) – The unicode emoji of the soundboard soundemoji_id (
str|None) – The ID of the custom emoji of the soundboard soundreason (
str|None) – The reason for creating the soundboard sound
- Return type:
- Returns:
The created soundboard sound
- Raises:
ValueError – If both emoji_name and emoji_id are set
- async fetch_guild_prune_count(*, days=7, include_roles=None) int¶
Fetch the amount of members that would be pruned.
- async begin_guild_prune(*, days=7, compute_prune_count=True, include_roles=None, reason=None) int | None¶
Begin a guild prune.
- Parameters:
- Return type:
- Returns:
The amount of members that were pruned
- get_partial_scheduled_event(id) PartialScheduledEvent¶
Creates a partial scheduled event object.
- Parameters:
id (
int) – The ID of the scheduled event.- Return type:
- Returns:
The partial scheduled event object.
- async fetch_scheduled_event(id) ScheduledEvent¶
Fetches a scheduled event object.
- Parameters:
id (
int) – The ID of the scheduled event.- Return type:
- Returns:
The scheduled event object.
- get_partial_role(role_id) PartialRole¶
Get a partial role object.
- Parameters:
role_id (
int) – The ID of the role- Return type:
- Returns:
The partial role object
- get_partial_channel(channel_id) PartialChannel¶
Get a partial channel object.
- Parameters:
channel_id (
int) – The ID of the channel- Return type:
- Returns:
The partial channel object
- async fetch_channel(channel_id) BaseChannel¶
Fetch a channel from the guild.
- Parameters:
channel_id (
int) – The ID of the channel- Return type:
- Returns:
The channel object
- get_partial_emoji(emoji_id) PartialEmoji¶
Get a partial emoji object.
- Parameters:
emoji_id (
int) – The ID of the emoji- Return type:
- Returns:
The partial emoji object
- get_partial_soundboard_sound(sound_id) PartialSoundboardSound¶
Get a partial soundboard sound object.
- Parameters:
sound_id (
int) – The ID of the sound- Return type:
- Returns:
The partial soundboard sound object
- async fetch_soundboard_sound(sound_id) SoundboardSound¶
Fetches a soundboard sound from the guild.
- Return type:
- Parameters:
sound_id (int)
- get_partial_sticker(sticker_id) PartialSticker¶
Get a partial sticker object.
- Parameters:
sticker_id (
int) – The ID of the sticker- Return type:
- Returns:
The partial sticker object
- get_partial_member(member_id) PartialMember¶
Get a partial member object.
- Parameters:
member_id (
int) – The ID of the member- Return type:
- Returns:
The partial member object
- async fetch_public_threads() list[PublicThread]¶
Fetches all the public threads in the guild.
- Return type:
- Returns:
The public threads in the guild
- async fetch_members(*, limit=1000, after=None) AsyncIterator[Member]¶
Fetches all the members in the guild.
- async fetch_regions() list[VoiceRegion]¶
Fetches all the voice regions for the guild.
- Return type:
- async bulk_ban(*members, delete_message_days=0, delete_message_seconds=0, reason=None) list[PartialMember]¶
Ban multiple members from the server.
- Parameters:
- Return type:
- Returns:
The banned members
- async ban(member, *, delete_message_days=0, delete_message_seconds=0, reason=None) None¶
Ban a member from the server.
- async fetch_channels() list[type[BaseChannel]]¶
Fetches all the channels in the guild.
- Return type:
- async fetch_audit_logs(*, before=None, after=None, user=None, action=None, limit=100) AsyncIterator[AuditLogEntry]¶
Fetches the audit logs for the guild.
- Parameters:
before (
datetime|AuditLogEntry|Snowflake|int|None) – Consider only entries before given entryafter (
datetime|AuditLogEntry|Snowflake|int|None) – Consider only entries after given entryuser (
Snowflake|int|None) – Consider only entries made by given useraction (
AuditLogType|None) – Consider only entries with given actionlimit (
int|None) – The maximum amount of messages to fetch.
- Return type:
- Returns:
The audit logs for the guild
- async fetch_integrations() list[Integration]¶
Fetches the integrations for the guild.
This requires the MANAGE_GUILD permission.
- Return type:
- Returns:
The integrations in the guild.
- async edit(*, name=<MISSING>, verification_level=<MISSING>, default_message_notifications=<MISSING>, explicit_content_filter=<MISSING>, afk_channel_id=<MISSING>, afk_timeout=<MISSING>, icon=<MISSING>, owner_id=<MISSING>, splash=<MISSING>, discovery_splash=<MISSING>, banner=<MISSING>, system_channel_id=<MISSING>, system_channel_flags=<MISSING>, rules_channel_id=<MISSING>, public_updates_channel_id=<MISSING>, preferred_locale=<MISSING>, description=<MISSING>, features=<MISSING>, premium_progress_bar_enabled=<MISSING>, safety_alerts_channel_id=<MISSING>, reason=None) PartialGuild¶
Edit the guild.
- Parameters:
verification_level (
VerificationLevel|None) – Verification level of the guilddefault_message_notifications (
DefaultNotificationLevel|None) – Default message notification level of the guildexplicit_content_filter (
ContentFilterLevel|None) – Explicit content filter level of the guildafk_channel_id (
VoiceChannel|PartialChannel|int|None) – AFK channel of the guildowner_id (
Member|PartialMember|int|None) – Owner of the guilddiscovery_splash (
File|None) – Discovery splash of the guildsystem_channel_id (
TextChannel|PartialChannel|int|None) – System channel of the guildsystem_channel_flags (
SystemChannelFlags|None) – System channel flags of the guildrules_channel_id (
TextChannel|PartialChannel|int|None) – Rules channel of the guildpublic_updates_channel_id (
TextChannel|PartialChannel|int|None) – Public updates channel of the guildpreferred_locale (
str|None) – Preferred locale of the guildpremium_progress_bar_enabled (
bool|None) – Whether the premium progress bar is enabledsafety_alerts_channel_id (
TextChannel|PartialChannel|int|None) – Safety alerts channel of the guild
- Return type:
- Returns:
The edited guild
- class discord_http.guild.PartialGuildTemplate(*, state, code, guild_id=None)¶
Bases:
objectRepresents a partial guild template object.
- Parameters:
state (DiscordAPI)
code (str)
guild_id (int | None)
- async fetch() GuildTemplate¶
Fetches the guild template.
- Return type:
- async sync() GuildTemplate¶
Syncs the template to the guild’s current state.
- Return type:
- async edit(*, name=<MISSING>, description=<MISSING>) GuildTemplate¶
Edits the template’s metadata.
- Parameters:
- Return type:
- Returns:
The edited template
- class discord_http.guild.PartialScheduledEvent(*, state, id, guild_id)¶
Bases:
PartialBaseRepresents a partial scheduled event in a guild.
- Parameters:
state (DiscordAPI)
id (int)
guild_id (int)
- property guild: Guild | PartialGuild¶
The guild object this event is in.
- async fetch() ScheduledEvent¶
Fetches more information about the event.
- Return type:
- async edit(*, name=<MISSING>, description=<MISSING>, channel=<MISSING>, external_location=<MISSING>, privacy_level=<MISSING>, entity_type=<MISSING>, status=<MISSING>, start_time=<MISSING>, end_time=<MISSING>, image=<MISSING>, recurrence_rule=<MISSING>, reason=None) ScheduledEvent¶
Edit the event.
- Parameters:
channel (
PartialChannel|int|None) – New channel of the eventexternal_location (
str|None) – New external location of the eventprivacy_level (
PrivacyLevelType|None) – New privacy level of the evententity_type (
ScheduledEventEntityType|None) – New entity type of the eventstatus (
ScheduledEventStatusType|None) – New status of the eventstart_time (
datetime|timedelta|int|None) – New start time of the eventend_time (
datetime|timedelta|int|None) – New end time of the event (only for external events)recurrence_rule (
ScheduledEventRecurrenceRule|None) – New recurrence rule of the event, if any
- Return type:
- Returns:
The edited event
- Raises:
ValueError – If the start_time is None
- async fetch_users(*, limit=100, with_member=False, before=None, after=None) list[User | Member]¶
Fetches the users interested in the event.
- Parameters:
limit (
int) – The maximum amount of users to fetch (1-100)with_member (
bool) – Whether to include guild member data for each user, if availablebefore (
datetime|Snowflake|int|None) – Consider only users before given user IDafter (
datetime|Snowflake|int|None) – Consider only users after given user ID
- Return type:
- Returns:
The users interested in the event
- class discord_http.guild.ScheduledEvent(*, state, data)¶
Bases:
PartialScheduledEventRepresents a scheduled event in a guild.
- Parameters:
state (DiscordAPI)
data (dict)
- privacy_level: PrivacyLevelType¶
The privacy level of the event.
- status: ScheduledEventStatusType¶
The status of the event.
- entity_type: ScheduledEventEntityType¶
The entity type of the event.
- recurrence_rule: ScheduledEventRecurrenceRule | None¶
The recurrence rule of the event, if any.
- property channel: PartialChannel | None¶
The channel the event is in, if applicable.
- async edit(*, name=<MISSING>, description=<MISSING>, channel=<MISSING>, external_location=<MISSING>, privacy_level=<MISSING>, entity_type=<MISSING>, status=<MISSING>, start_time=<MISSING>, end_time=<MISSING>, image=<MISSING>, recurrence_rule=<MISSING>, reason=None) ScheduledEvent¶
Edit the event.
- Parameters:
channel (
PartialChannel|int|None) – New channel of the eventexternal_location (
str|None) – New external location of the eventprivacy_level (
PrivacyLevelType|None) – New privacy level of the evententity_type (
ScheduledEventEntityType|None) – New entity type of the eventstatus (
ScheduledEventStatusType|None) – New status of the eventstart_time (
datetime|timedelta|int|None) – New start time of the eventend_time (
datetime|timedelta|int|None) – New end time of the event (only for external events)recurrence_rule (
ScheduledEventRecurrenceRule|None) – New recurrence rule of the event, if any
- Return type:
- Returns:
The edited event
- Raises:
ValueError – If the start_time is None
- async fetch() ScheduledEvent¶
Fetches more information about the event.
- Return type:
- async fetch_users(*, limit=100, with_member=False, before=None, after=None) list[User | Member]¶
Fetches the users interested in the event.
- Parameters:
limit (
int) – The maximum amount of users to fetch (1-100)with_member (
bool) – Whether to include guild member data for each user, if availablebefore (
datetime|Snowflake|int|None) – Consider only users before given user IDafter (
datetime|Snowflake|int|None) – Consider only users after given user ID
- Return type:
- Returns:
The users interested in the event
- property guild: Guild | PartialGuild¶
The guild object this event is in.
- class discord_http.guild.ScheduledEventRecurrenceRule(start, frequency, interval, end=None, by_weekday=None, by_n_weekday=None, by_month=None, by_month_day=None, by_year_day=None, count=None)¶
Bases:
NamedTupleRepresents the recurrence rule of a scheduled event.
- Parameters:
start (datetime)
frequency (ScheduledEventRecurrenceFrequency)
interval (int)
end (datetime | None)
by_weekday (list[ScheduledEventRecurrenceWeekday] | None)
by_n_weekday (list[ScheduledEventRecurrenceRuleNWeekday] | None)
by_month (list[ScheduledEventRecurrenceMonth] | None)
count (int | None)
- frequency: ScheduledEventRecurrenceFrequency¶
Alias for field number 1
- by_weekday: list[ScheduledEventRecurrenceWeekday] | None¶
Alias for field number 4
- by_n_weekday: list[ScheduledEventRecurrenceRuleNWeekday] | None¶
Alias for field number 5
- by_month: list[ScheduledEventRecurrenceMonth] | None¶
Alias for field number 6
- to_dict() dict¶
Turns the recurrence rule into a payload for the API.
Only the fields that can be set externally are included, as the rest are only ever provided by Discord.
- Return type:
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class discord_http.guild.ScheduledEventRecurrenceRuleNWeekday(n, day)¶
Bases:
NamedTupleRepresents a specific weekday within a specific week for a scheduled event recurrence rule.
- Parameters:
n (int)
- day: ScheduledEventRecurrenceWeekday¶
Alias for field number 1
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class discord_http.guild.WelcomeScreen(*, state, guild_id, data)¶
Bases:
objectRepresents a guild’s welcome screen.
- Parameters:
state (DiscordAPI)
guild_id (int)
data (dict)
- welcome_channels: list[WelcomeScreenChannel]¶
The channels shown in the welcome screen.
- class discord_http.guild.WelcomeScreenChannel(*, state, guild_id, data)¶
Bases:
objectRepresents a channel shown in a guild’s welcome screen.
- Parameters:
state (DiscordAPI)
guild_id (int)
data (dict)
- property emoji: PartialEmoji | None¶
The partial custom emoji shown next to the channel, if any.
- property channel: PartialChannel¶
The channel shown in the welcome screen.
- channel_id¶