Guild¶
discord_http.guild module¶
- class discord_http.guild.BanEntry(user, reason)¶
Bases:
NamedTuple- 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)¶
Bases:
PartialGuildRepresents a guild (server) in Discord.
- Parameters:
state (DiscordAPI)
data (dict)
- 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]¶
Returns a list of all the category channels in the guild if they are cached.
- property channels: list[BaseChannel | PartialChannel]¶
Returns 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, 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 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_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
- property emojis: list[Emoji | PartialEmoji]¶
Returns 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_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:
- 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_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:
- guild_id¶
- property me: Member | PartialMember | None¶
Returns the bot’s member object.
Only useable if you are using gateway and caching
- property members: list[Member | PartialMember]¶
Returns a list of all the members in the guild if they are cached.
- property roles: list[Role | PartialRole]¶
Returns a list of all the roles in the guild if they are cached or if the guild was fetched.
- property soundboard_sounds: list[SoundboardSound | PartialSoundboardSound]¶
Returns a list of all the soundboard sounds in the guild if they are cached.
- property stickers: list[Sticker | PartialSticker]¶
Returns a list of all the stickers in the guild if they are cached.
- property text_channels: list[TextChannel]¶
Returns a list of all the text channels in the guild if they are cached.
- property threads: list[BaseChannel | PartialChannel]¶
Returns 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]¶
Returns a list of all the voice channels in the guild if they are cached.
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.
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.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¶
Returns 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]¶
Returns a list of all the members in the guild if they are cached.
- property channels: list[BaseChannel | PartialChannel]¶
Returns a list of all the channels in the guild if they are cached.
- property threads: list[BaseChannel | PartialChannel]¶
Returns a list of all the threads in the guild if they are cached.
- property roles: list[Role | PartialRole]¶
Returns a list of all the roles in the guild if they are cached or if the guild was fetched.
- property emojis: list[Emoji | PartialEmoji]¶
Returns a list of all the emojis in the guild if they are cached.
- property soundboard_sounds: list[SoundboardSound | PartialSoundboardSound]¶
Returns a list of all the soundboard sounds in the guild if they are cached.
- property stickers: list[Sticker | PartialSticker]¶
Returns a list of all the stickers in the guild if they are cached.
- property text_channels: list[TextChannel]¶
Returns a list of all the text channels in the guild if they are cached.
- property voice_channels: list[VoiceChannel]¶
Returns a list of all the voice channels in the guild if they are cached.
- property categories: list[CategoryChannel]¶
Returns a list of all the category channels in the guild if they are cached.
- property default_role: PartialRole¶
Returns the default role, but as a partial role object.
- get_partial_automod_rule(automod_id) PartialAutoModRule¶
Returns a partial automod rule object.
- Return type:
- Parameters:
automod_id (int)
- 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, 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 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
- guild_id¶
- 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>, 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)
- Return type:
- Returns:
The edited event
- Raises:
ValueError – If the start_time is None
- 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.
- 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>, 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)
- 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:
- property guild: Guild | PartialGuild¶
The guild object this event is in.