Pincer Objects Guild#
Audit Log#
AuditLogEvent#
- BOT_ADD
- CHANNEL_CREATE
- CHANNEL_DELETE
- CHANNEL_OVERWRITE_CREATE
- CHANNEL_OVERWRITE_DELETE
- CHANNEL_OVERWRITE_UPDATE
- CHANNEL_UPDATE
- EMOJI_CREATE
- EMOJI_DELETE
- EMOJI_UPDATE
- GUILD_UPDATE
- INTEGRATION_CREATE
- INTEGRATION_DELETE
- INTEGRATION_UPDATE
- INVITE_CREATE
- INVITE_DELETE
- INVITE_UPDATE
- MEMBER_BAN_ADD
- MEMBER_BAN_REMOVE
- MEMBER_DISCONNECT
- MEMBER_KICK
- MEMBER_MOVE
- MEMBER_PRUNE
- MEMBER_ROLE_UPDATE
- MEMBER_UPDATE
- MESSAGE_BULK_DELETE
- MESSAGE_DELETE
- MESSAGE_PIN
- MESSAGE_UNPIN
- ROLE_CREATE
- ROLE_DELETE
- ROLE_UPDATE
- STAGE_INSTANCE_CREATE
- STAGE_INSTANCE_DELETE
- STAGE_INSTANCE_UPDATE
- STICKER_CREATE
- STICKER_DELETE
- STICKER_UPDATE
- THREAD_CREATE1
- THREAD_DELETE1
- THREAD_UPDATE1
- WEBHOOK_CREATE
- WEBHOOK_DELETE
- WEBHOOK_UPDATE
- class AuditLogEvent#
Bases:
IntEnum
Audit log action type. This represents the action which got performed, and logged.
- GUILD_UPDATE#
Guild updated.
- CHANNEL_CREATE#
Channel created.
- CHANNEL_UPDATE#
Channel updated.
- CHANNEL_DELETE#
Channel deleted.
- CHANNEL_OVERWRITE_CREATE#
Channel overwrites created.
- CHANNEL_OVERWRITE_UPDATE#
Channel overwrites updated.
- CHANNEL_OVERWRITE_DELETE#
Channel overwrites deleted.
- MEMBER_KICK#
Member kicked.
- MEMBER_PRUNE#
Members pruned.
- MEMBER_BAN_ADD#
Member banned.
- MEMBER_BAN_REMOVE#
Member unbanned.
- MEMBER_UPDATE#
Member edit.
- MEMBER_ROLE_UPDATE#
Member role change.
- MEMBER_MOVE#
Member voice channel move.
- MEMBER_DISCONNECT#
Member voice channel disconnect.
- BOT_ADD#
Bot added.
- ROLE_CREATE#
Role created.
- ROLE_UPDATE#
Role updated.
- ROLE_DELETE#
Role deleted.
- INVITE_CREATE#
Invite created.
- INVITE_UPDATE#
Invite updated.
- INVITE_DELETE#
Invite deleted.
- WEBHOOK_CREATE#
Webhook created.
- WEBHOOK_UPDATE#
Webhook updated.
- WEBHOOK_DELETE#
Webhook deleted.
- EMOJI_CREATE#
Emoji created.
- EMOJI_UPDATE#
Emoji updated.
- EMOJI_DELETE#
Emoji deleted.
- MESSAGE_DELETE#
Message deleted.
- MESSAGE_BULK_DELETE#
Message bulk delete.
- MESSAGE_PIN#
Message pinned.
- MESSAGE_UNPIN#
Message unpinned.
- INTEGRATION_CREATE#
Integration created.
- INTEGRATION_UPDATE#
Integration updated.
- INTEGRATION_DELETE#
Integration deleted.
- STAGE_INSTANCE_CREATE#
Stage instance created.
- STAGE_INSTANCE_UPDATE#
Stage instance updated.
- STAGE_INSTANCE_DELETE#
Stage instance deleted.
- STICKER_CREATE#
Sticker created.
- STICKER_UPDATE#
Sticker updated.
- STICKER_DELETE#
Sticker deleted.
- THREAD_CREATE1#
Thread created.
- THREAD_UPDATE1#
Thread updated.
- THREAD_DELETE1#
Thread deleted.
AuditLogChange#
AuditEntryInfo#
- class AuditEntryInfo#
Bases:
APIObject
,ChannelProperty
Represents Discord Optional Audit Entry Info
AuditLogEntry#
- class AuditLogEntry#
Bases:
APIObject
Represents a Discord Audit Log Entry object.
- action_type#
Type of action that occurred
- Type
- changes#
Changes made to the target_id
- Type
APINullable[List[
AuditLogChange
]]
- options#
Additional info for certain action types
- Type
APINullable[List[
AuditLogChange
]]
AuditLog#
- class AuditLog#
Bases:
APIObject
Represents a Discord Audit Log object.
- webhooks: List[
Webhook
] list of webhooks found in the audit log
- users: List[
User
] list of users found in the audit log
- audit_log_entries: List[
AuditLogEntry
] list of audit log entries
- integrations: List[
Integration
] list of partial integration objects
- threads: List[
Channel
] list of threads found in the audit log
- webhooks: List[
Ban#
Ban#
Channel#
ChannelType#
- class ChannelType#
Bases:
IntEnum
Represents a channel its type.
- GUILD_TEXT#
A text channel.
- DM#
A DM channel.
- GUILD_VOICE#
A voice channel.
- GROUP_DM#
A group DM channel.
- GUILD_CATEGORY#
A category channel.
- GUILD_NEWS#
A news channel.
- GUILD_STORE#
A store channel.
- GUILD_NEWS_THREAD#
A news thread.
- GUILD_PUBLIC_THREAD#
A public thread.
- GUILD_PRIVATE_THREAD#
A private thread.
- GUILD_STAGE_VOICE#
A stage channel.
Channel#
- application_id
- bitrate
- default_auto_archive_duration
- guild_id
- icon
- id
- last_message_id
- last_pin_timestamp
- member
- member_count
- message_count
- name
- nsfw
- owner_id
- parent_id
- permission_overwrites
- permissions
- position
- rate_limit_per_user
- recipients
- rtc_region
- thread_metadata
- topic
- type
- user_limit
- video_quality_mode
- clsChannel.from_id
- asyncbulk_delete_messages
- asynccreate_invite
- asyncdelete
- asyncdelete_permission
- asyncedit
- asyncedit_permissions
- asyncfollow_news_channel
- asyncget_invites
- asyncget_pinned_messages
- asyncget_webhooks
- asyncgroup_dm_add_recipient
- asyncgroup_dm_remove_recipient
- asynclist_active_threads
- asynclist_joined_private_archived_threads
- asynclist_private_archived_threads
- asynclist_public_archived_threads
- asyncpin_message
- asyncsend
- asynctrigger_typing_indicator
- asyncunpin_message
- class Channel#
Bases:
APIObject
,GuildProperty
Represents a Discord Channel Mention object
- type#
The type of channel
- Type
- application_id#
Application id of the group DM creator if it is bot-created
- Type
APINullable[
Snowflake
]
- default_auto_archive_duration#
Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080
- Type
APINullable[
int
]
- guild_id#
The id of the guild (maybe missing for some channel objects received over gateway guild dispatches)
- Type
APINullable[
Snowflake
]
- last_message_id#
The id of the last message sent in this channel (may not point to an existing or valid message)
- Type
APINullable[Optional[
Snowflake
]]
- last_pin_timestamp#
When the last pinned message was pinned. This may be null in events such as GUILD_CREATE when a message is not pinned.
- Type
APINullable[Optional[
Timestamp
]]
- member#
Thread member object for the current user, if they have joined the thread, only included on certain API endpoints
- Type
APINullable[
GuildMember
]
- parent_id#
For guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created
- Type
APINullable[Optional[
Snowflake
]]
- permissions#
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction
- Type
APINullable[
str
]
- permission_overwrites#
Explicit permission overwrites for members and roles
- Type
APINullable[List[
Overwrite
]]
- rate_limit_per_user#
Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected
- Type
APINullable[
int
]
- rtc_region#
Voice region id for the voice channel, automatic when set to null
- Type
APINullable[Optional[
str
]]
- thread_metadata#
Thread-specific fields not needed by other channels
- Type
APINullable[
ThreadMetadata
]
- video_quality_mode#
The camera video quality mode of the voice channel, 1 when not present
- Type
APINullable[
int
]
- await bulk_delete_messages(messages, reason=None)#
This function is a coroutine. Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the
MANAGE_MESSAGES
permission.This endpoint will not delete messages older than 2 weeks, and will fail with a 400 BAD REQUEST if any message provided is older than that or if any duplicate message IDs are provided.
- await create_invite(max_age=86400, max_uses=0, temporary=False, unique=False, target_type=None, target_user_id=None, target_application_id=None, reason=None)#
This function is a coroutine. Create a new invite object for the channel. Only usable for guild channels. Requires the
CREATE_INSTANT_INVITE
permission.- Parameters
max_age (Optional[
int
]) – Duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days).Default:86400
max_uses (Optional[
int
]) – Maximum number of uses.0
for unlimited. Values between 0 and 100.Default:0
temporary (Optional[
bool
]) – Whether the invite only grants temporary membership.Default:False
unique (Optional[
bool
]) – IfTrue
, don’t try to reuse a similar invite (useful for creating many unique one time use invites).Default:False
target_type (Optional[
InviteTargetType
]) – The type of target for the invite.Default:None
target_user_id (Optional[
Snowflake
]) – The id of the user whose stream to display for this invite. Required iftarget_type
isSTREAM
, the user must be streaming in the channel.Default:None
target_application_id (Optional[
Snowflake
]) – The id of the embedded application to open for this invite. Required iftarget_type
isEMBEDDED_APPLICATION
, the application must have theEMBEDDED
flag.Default:None
reason (Optional[
str
]) – The reason of the invite creation.Default:None
- Returns
The invite object.
- Return type
- await delete(reason=None, /, channel_id=None)#
This function is a coroutine.
Delete the current channel.
:param reason Optional[
str
]: The reason of the channel delete. :param channel_idSnowflake
: The id of the channel, defaults to the current object id.
- await delete_permission(overwrite, reason=None)#
This function is a coroutine. Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the
MANAGE_ROLES
permission.
- await edit(reason=None, **kwargs)#
This function is a coroutine. Edit a channel with the given keyword arguments.
:param reason Optional[
str
]: The reason of the channel edit. :param **kwargs: The keyword arguments to edit the channel with.- Returns
The updated channel object.
- Return type
- await edit_permissions(overwrite, allow, deny, type, reason=None)#
This function is a coroutine. Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the
MANAGE_ROLES
permission. Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has aMANAGE_ROLES
overwrite in the channel).
- await follow_news_channel(webhook_channel_id)#
This function is a coroutine. Follow a News Channel to send messages to a target channel. Requires the
MANAGE_WEBHOOKS
permission in the target channel. Returns a followed channel object.- Parameters
webhook_channel_id (
Snowflake
) – The ID of the channel to follow.- Returns
The followed channel object.
- Return type
- classmethod await from_id(client, channel_id)#
This function is a coroutine. Creates a channel object. You should use the
get_channel
method fromClient
most of the time. Theget_dm_channel
method fromUser
should be used if you need to create a dm_channel. Using thesend()
method fromUser
is preferred.
- get_invites()#
This function is a coroutine. Fetches all the invite objects for the channel. Only usable for guild channels. Requires the
MANAGE_CHANNELS
permission.- Returns
Invites iterator.
- Return type
AsyncIterator[
Invite
]
- get_pinned_messages()#
This function is a coroutine. Fetches all pinned messages in the channel. Returns an iterator of pinned messages.
- Returns
An iterator of pinned messages.
- Return type
AsyncIterator[:class:`~pincer.objects.guild.message.UserMessage
]`
- get_webhooks()#
This function is a coroutine. Get all webhooks in the channel. Requires the
MANAGE_WEBHOOKS
permission.- Yields
AsyncGenerator[
Webhook
, None]
- await group_dm_add_recipient(user, access_token=None, nick=None)#
This function is a coroutine. Adds a recipient to a Group DM using their access token.
- await group_dm_remove_recipient(user)#
This function is a coroutine. Removes a recipient from a Group DM.
- Parameters
user (
User
) – The user to remove.
- await list_active_threads()#
This function is a coroutine. Returns all active threads in the channel, including public and private threads. Threads are ordered by their id, in descending order.
- Returns
The response object.
- Return type
ThreadsResponse
- await list_joined_private_archived_threads(before=None, limit=None)#
This function is a coroutine. Returns archived threads in the channel that are of type
GUILD_PRIVATE_THREAD
, and the user has joined. Threads are ordered by their id, in descending order. Requires theREAD_MESSAGE_HISTORY
permission.- Parameters
before (Optional[
Timestamp
]) – Returns threads before this timestamp.Default:None
limit (Optional[
int
]) – The maximum number of threads to return.Default:None
- Returns
The response object.
- Return type
ThreadsResponse
- await list_private_archived_threads(before=None, limit=None)#
This function is a coroutine. Returns archived threads in the channel that are of type
GUILD_PRIVATE_THREAD
. Threads are ordered byarchive_timestamp
, in descending order. Requires both theREAD_MESSAGE_HISTORY
andMANAGE_THREADS
permissions.- Parameters
before (Optional[
Timestamp
]) – Returns threads before this timestamp.Default:None
limit (Optional[
int
]) – The maximum number of threads to return.Default:None
- Returns
The response object.
- Return type
ThreadsResponse
- await list_public_archived_threads(before=None, limit=None)#
This function is a coroutine. Returns archived threads in the channel that are public. When called on a
GUILD_TEXT
channel, returns threads of typeGUILD_PUBLIC_THREAD
. When called on aGUILD_NEWS
channel returns threads of typeGUILD_NEWS_THREAD
. Threads are ordered byarchive_timestamp
, in descending order. Requires theREAD_MESSAGE_HISTORY
permission.- Parameters
before (Optional[
Timestamp
]) – Returns threads before this timestamp.Default:None
limit (Optional[
int
]) – The maximum number of threads to return.Default:None
- Returns
The response object.
- Return type
ThreadsResponse
- await pin_message(message, reason=None)#
This function is a coroutine. Pin a message in a channel. Requires the
MANAGE_MESSAGES
permission. The maximum number of pinned messages is50
.- Parameters
reason (Optional[
str
]) – The reason of the channel message pin.
- await send(message)#
This function is a coroutine.
Send a message in the channel.
:param message
Message
: The message which must be sent- Returns
The message that was sent.
- Return type
- await trigger_typing_indicator()#
This function is a coroutine. Post a typing indicator for the specified channel. Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message.
- await unpin_message(message, reason=None)#
This function is a coroutine. Unpin a message in a channel. Requires the
MANAGE_MESSAGES
permission.- Parameters
reason (Optional[
str
]) – The reason of the channel message unpin.
TextChannel#
Methods- asyncedit
- asyncfetch_message
- asynchistory
- class TextChannel#
Bases:
Channel
A subclass of
Channel
for text channels with all the same attributes.- await edit(**kwargs)#
This function is a coroutine. Edit a text channel with the given keyword arguments.
- Parameters
**kwargs – The keyword arguments to edit the channel with.
- Returns
The updated channel object.
- Return type
- await fetch_message(message_id)#
This function is a coroutine. Returns a UserMessage from this channel with the given id.
- Parameters
message_id – The message ID to look for.
- Returns
The requested message.
- Return type
- async for ... in history(limit=50, before=None, after=None, around=None)#
This function is a coroutine. Returns a list of messages in this channel.
- Parameters
around (Optional[Union[
int
,Snowflake
]]) – The message ID to look around.after (Optional[Union[
int
,Snowflake
]]) – The message ID to look after.before (Optional[Union[
int
,Snowflake
]]) – The message ID to look before.limit (Optional[Union[
int
,Snowflake
]]) – The maximum number of messages to return.
- Returns
An iterator of messages.
- Return type
AsyncIterator[
UserMessage
]
VoiceChannel#
Methods- asyncedit
CategoryChannel#
NewsChannel#
Methods- asyncedit
ChannelMention#
Features#
GuildFeature#
Attributes- ANIMATED_ICON
- BANNER
- COMMERCE
- COMMUNITY
- DISCOVERABLE
- FEATURABLE
- INVITE_SPLASH
- MEMBER_VERIFICATION_GATE_ENABLED
- MONETIZATION_ENABLED
- MORE_STICKERS
- NEWS
- PARTNERED
- PREVIEW_ENABLED
- PRIVATE_THREADS
- SEVEN_DAY_THREAD_ARCHIVE
- THREADS_ENABLED
- THREE_DAY_THREAD_ARCHIVE
- TICKETED_EVENTS_ENABLED
- VANITY_URL
- VERIFIED
- VIP_REGIONS
- WELCOME_SCREEN_ENABLED
Followed Channel#
FollowedChannel#
AttributesGuild#
GuildNSFWLevel#
AttributesExplicitContentFilterLevel#
Attributes- class ExplicitContentFilterLevel#
Bases:
IntEnum
Represents the filter content level of a guild. .. attribute:: DISABLED
Media content will not be scanned.
- MEMBERS_WITHOUT_ROLES#
Media content sent by members without roles will be scanned.
- ALL_MEMBERS#
Media content sent by all members will be scanned.
MFALevel#
AttributesVerificationLevel#
- class VerificationLevel#
Bases:
IntEnum
Represents the verification level of a guild. .. attribute:: NONE
Unrestricted.
- LOW#
Must have verified email on account.
- MEDIUM#
Must be registered on Discord for longer than 5 minutes.
- HIGH#
Must be a member of the server for longer than 10 minutes.
- VERY_HIGH#
Must have a verified phone number.
DefaultMessageNotificationLevel#
Attributes- class DefaultMessageNotificationLevel#
Bases:
IntEnum
Represents the default message notification level of a guild. .. attribute:: ALL_MESSAGES
Members will receive notifications for all messages by default.
- ONLY_MENTIONS#
Members will receive notifications only for messages that @mention them by default.
SystemChannelFlags#
- class SystemChannelFlags#
Bases:
IntEnum
Represents the system channel flags of a guild. .. attribute:: SUPPRESS_JOIN_NOTIFICATIONS
Suppress member join notifications.
- SUPPRESS_PREMIUM_SUBSCRIPTIONS#
Suppress server boost notifications.
- SUPPRESS_GUILD_REMINDER_NOTIFICATIONS#
Suppress server setup tips.
- SUPPRESS_JOIN_NOTIFICATION_REPLIES#
Hide member join sticker reply buttons
Guild#
Attributes- afk_timeout
- application_id
- approximate_member_count
- approximate_presence_count
- banner
- channels
- default_message_notifications
- description
- discovery_splash
- emojis
- explicit_content_filter
- features
- icon
- icon_hash
- id
- joined_at
- large
- max_members
- max_presences
- max_video_channel_users
- member_count
- members
- mfa_level
- name
- nsfw
- nsfw_level
- owner
- owner_id
- permissions
- preferred_locale
- premium_subscription_count
- premium_tier
- presences
- public_updates_channel_id
- region
- roles
- rules_channel_id
- splash
- stage_instances
- stickers
- system_channel_flags
- system_channel_id
- threads
- unavailable
- vanity_url_code
- verification_level
- voice_states
- welcome_screen
- widget_channel_id
- widget_enabled
Methods- clsGuild.from_dict
- clsGuild.from_id
- asyncadd_guild_member_role
- asyncban
- asynccreate_emoji
- asynccreate_scheduled_event
- asynccreate_sticker
- asynccreate_template
- asyncdelete
- asyncdelete_emoji
- asyncdelete_integration
- asyncdelete_invite
- asyncdelete_role
- asyncdelete_scheduled_event
- asyncdelete_sticker
- asyncdelete_template
- asyncedit_emoji
- asyncedit_role_position
- asyncedit_template
- asyncget_audit_log
- asyncget_ban
- asyncget_bans
- asyncget_emoji
- asyncget_emojis
- defget_guild_scheduled_event_users
- asyncget_integrations
- asyncget_invite
- asyncget_invites
- asyncget_member
- asyncget_roles
- asyncget_scheduled_event
- defget_scheduled_events
- asyncget_sticker
- asyncget_templates
- asyncget_voice_regions
- asyncget_webhooks
- asyncget_welcome_screen
- asyncget_widget
- asyncget_widget_image
- asyncget_widget_settings
- asynckick
- asynclist_active_threads
- asynclist_guild_members
- asynclist_stickers
- asyncmodify_channel_positions
- asyncmodify_current_member
- asyncmodify_current_user_voice_state
- asyncmodify_scheduled_event
- asyncmodify_user_voice_state
- asyncmodify_welcome_screen
- asyncmodify_widget
- asyncpreview
- asyncprune
- asyncprune_count
- asyncremove_guild_member
- asyncremove_guild_member_role
- asyncsearch_guild_members
- asyncsync_template
- asyncunban
- asyncvanity_url
- class Guild#
Bases:
APIObject
Represents a Discord guild/server in which your client resides. .. attribute:: afk_channel_id
Id of afk channel
- type
Optional[
Snowflake
]
- default_message_notifications#
Default message notifications level
- discovery_splash#
Discovery splash hash; only present for guilds with the “DISCOVERABLE” feature
- Type
Optional[
str
]
- explicit_content_filter#
Explicit content filter level
- features#
Enabled guild features
- Type
List[
GuildFeature
]
- nsfw_level#
Guild NSFW level
- Type
NSFWLevel
- preferred_locale#
The preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to “en-US”
- Type
Premium tier (Server Boost level)
- Type
- public_updates_channel_id#
The id of the channel where admins and moderators of Community guilds receive notices from Discord
- Type
Optional[
Snowflake
]
- rules_channel_id#
The id of the channel where Community guilds can display rules and/or guidelines
- Type
Optional[
Snowflake
]
- system_channel_flags#
System channel flags
- Type
- system_channel_id#
The id of the channel where guild notices such as welcome messages and boost events are posted
- Type
Optional[
Snowflake
]
- verification_level#
Verification level required for the guild
- Type
- approximate_member_count#
Approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
- Type
APINullable[
int
]
- approximate_presence_count#
Approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
- Type
APINullable[
int
]
- max_presences#
The maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
- Type
APINullable[Optional[
int
]]
- members#
Users in the guild
- Type
APINullable[List[
GuildMember
]]
- permissions#
Total permissions for the user in the guild (excludes overwrites)
- Type
APINullable[
str
]
The number of boosts this guild currently has
- Type
APINullable[
int
]
- presences#
Presences of the members in the guild, will only include non-offline members if the size is greater than large threshold
- Type
APINullable[List[
PresenceUpdateEvent
]]
- stage_instances#
Stage instances in the guild
- Type
APINullable[List[
StageInstance
]]
- threads#
All active threads in the guild that current user has permission to view
- Type
APINullable[List[
Channel
]]
True if this guild is unavailable due to an outage
- Type
APINullable[
bool
]
- voice_states#
States of members currently in voice channels; lacks the guild_id key
- Type
APINullable[List[
VoiceState
]]
- widget_channel_id#
The channel id that the widget will generate an invite to, or null if set to no invite
- Type
APINullable[Optional[
Snowflake
]]
- welcome_screen#
The welcome screen of a Community guild, shown to new members, returned in an Invite’s guild object
- Type
APINullable[
WelcomeScreen
]
- await add_guild_member_role(user_id, role_id, reason=None)#
This function is a coroutine. Adds a role to a guild member.
- Parameters
user_id (int) – id of the user to give a role to
role_id (int) – id of a role
reason (Optional[
str
]) – audit log reasonDefault:None
- await ban(member, reason=None, delete_message_days=None)#
Ban a guild member.
- Parameters
member (Union[
int
,GuildMember
]) – ID or object of the guild member to ban.reason (Optional[
str
]) – Reason for the kick.delete_message_days (Optional[
int
]) – Number of days to delete messages for (0-7)
- await create_emoji(*, name, image, roles=None, reason=None)#
This function is a coroutine. Creates a new emoji for the guild. Requires the
MANAGE_EMOJIS_AND_STICKERS
permission.Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail.
- Parameters
name (
str
) – Name of the emojiimage (
File
) – The File for the 128x128 emoji image dataroles (Optional[List[
Snowflake
]]) – Roles allowed to use this emojiDefault:[]
reason (Optional[
str
]) – The reason for creating the emojiDefault:None
- Returns
The newly created emoji object.
- Return type
Emoji
- await create_scheduled_event(name, privacy_level, entity_type, scheduled_start_time, scheduled_end_time=None, entity_metadata=None, channel_id=None, description=None, reason=None)#
Create a new scheduled event for the guild.
- Parameters
name (
str
) – The name of the scheduled event.privacy_level (
int
) – The privacy level of the scheduled event.entity_type (
int
) – The type of entity to be scheduled.scheduled_start_time (
datetime
) – The scheduled start time of the event.scheduled_end_time (Optional[
datetime
]) – The scheduled end time of the event.entity_metadata (Optional[
str
]) – The metadata of the entity to be scheduled.channel_id (Optional[
int
]) – The channel id of the channel to be scheduled.description (Optional[
str
]) – The description of the scheduled event.reason (Optional[
str
]) – The reason for creating the scheduled event.
- Raises
ValueError: – If an event is created in the past or if an event ends before it starts
- Returns
The newly created scheduled event.
- Return type
ScheduledEvent
- await create_sticker(name, tags, description, file, reason=None)#
This function is a coroutine. Create a new sticker for the guild. Requires the
MANAGE_EMOJIS_AND_STICKERS permission
.- Parameters
name (str) – name of the sticker (2-30 characters)
tags (str) – autocomplete/suggestion tags for the sticker (max 200 characters)
file (
File
) – the sticker file to upload, must be a PNG, APNG, or Lottie JSON file, max 500 KBdescription (str) – description of the sticker (empty or 2-100 characters)
Default:""
reason (Optional[
str
]Default:None
) – reason for creating the sticker- Returns
the newly created sticker
- Return type
- await create_template(name, description=None)#
This function is a coroutine. Creates a new template for the guild. Requires the
MANAGE_GUILD
permission.- Parameters
name (
str
) – Name of the template (1-100 characters)description (Optional[
str
]) – Description of the template (0-120 characters)Default:None
- Returns
The newly created template object.
- Return type
- await delete_emoji(id, *, reason=None)#
This function is a coroutine. Deletes the given emoji. Requires the
MANAGE_EMOJIS_AND_STICKERS
permission.- Parameters
id (
Snowflake
) – The ID of the emojireason (Optional[
str
]) – The reason for deleting the emojiDefault:None
- await delete_integration(integration, reason=None)#
This function is a coroutine. Deletes an integration. Requires the
MANAGE_GUILD
permission.- Parameters
integration (
Integration
) – The integration to delete.reason (Optional[
str
]) – Reason for the deletionDefault:None
- await delete_invite(code)#
This function is a coroutine. Deletes an invite. Requires the
MANAGE_GUILD
intent.- Parameters
code (
str
) – The code of the invite to delete.
- await delete_role(id, reason=None)#
This function is a coroutine. Deletes a role. Requires the MANAGE_ROLES permission.
- Parameters
id (
Snowflake
) – The role IDreason (Optional[
str
]) – The reason for deleting the roleDefault:None
- await delete_scheduled_event(_id)#
Delete a scheduled event.
- Parameters
_id (
int
) – The id of the scheduled event.
- await delete_sticker(_id)#
This function is a coroutine. Delete the given sticker. Requires the
MANAGE_EMOJIS_AND_STICKERS
permission.- Parameters
_id (Snowflake) – id of the sticker
- await delete_template(template)#
This function is a coroutine. Deletes the given template. Requires the
MANAGE_GUILD
permission.- Parameters
template (
GuildTemplate
) – The template to delete- Returns
The deleted template object.
- Return type
- await edit_emoji(id, *, name=None, roles=None, reason=None)#
This function is a coroutine. Modifies the given emoji. Requires the
MANAGE_EMOJIS_AND_STICKERS
permission.- Parameters
id (
Snowflake
) – The ID of the emojiname (Optional[
str
]) – Name of the emojiDefault:None
roles (Optional[List[
Snowflake
]]) – Roles allowed to use this emojiDefault:None
reason (Optional[
str
]) – The reason for editing the emojiDefault:None
- Returns
The modified emoji object.
- Return type
Emoji
- edit_role_position(id, reason=None, position=None)#
This function is a coroutine. Edits the position of a role.
- Parameters
id (
Snowflake
) – The role IDreason (Optional[
str
]) – Reason for editing the role position.Default:None
position (Optional[
int
]) – Sorting position of the roleDefault:None
- Yields
AsyncGenerator[
Role
,None
] – An async generator of all the guild’s role objects.- await edit_template(template, *, name=None, description=None)#
This function is a coroutine. Modifies the template’s metadata. Requires the
MANAGE_GUILD
permission.- Parameters
template (
GuildTemplate
) – The template to editname (Optional[
str
]) – Name of the template (1-100 characters)Default:None
description (Optional[
str
]) – Description of the template (0-120 characters)Default:None
- Returns
The edited template object.
- Return type
- classmethod from_dict(data)#
- Parameters
data (
Dict
) – Guild data received from the discord API.- Returns
The new guild object.
- Return type
- Raises
UnavailableGuildError – The guild is unavailable due to a discord outage.
- classmethod await from_id(client, _id, with_counts=False)#
- await get_audit_log()#
This function is a coroutine. Returns an audit log object for the guild. Requires the
VIEW_AUDIT_LOG
permission.- Returns
The audit log object for the guild.
- Return type
- await get_emoji(id)#
This function is a coroutine. Returns an emoji object for the given ID.
- Parameters
id (
Snowflake
) – The ID of the emoji- Returns
The emoji object.
- Return type
Emoji
- get_emojis()#
This function is a coroutine. Returns an async generator of the emojis in the guild.
- Yields
Emoji
– The emoji object.
- get_guild_scheduled_event_users(_id, limit=100, with_member=False, before=None, after=None)#
Get the users of a scheduled event.
- Parameters
_id (
int
) – The id of the scheduled event.limit (
int
) – The number of users to retrieve.with_member (
bool
) – Whether to include the member object in the scheduled event user.before (Optional[
int
]) – consider only users before given user idafter (Optional[
int
]) – consider only users after given user id
- Yields
GuildScheduledEventUser
– The scheduled event user object.
- get_integrations()#
This function is a coroutine. Returns an async generator of integrations for the guild. Requires the
MANAGE_GUILD
permission.- Yields
AsyncGenerator[
Integration
,None
] – An async generator of integrations.
- await get_invite(code)#
This function is a coroutine. Returns an Invite object for the given invite code.
- get_invites()#
This function is a coroutine. Returns an async generator of invites for the guild. Requires the
MANAGE_GUILD
permission.- Yields
AsyncGenerator[
Invite
,None
] – An async generator of invites.
- await get_member(_id)#
This function is a coroutine. Fetches a GuildMember from its identifier
- Parameters
_id (int) – The id of the guild member which should be fetched from the Discord gateway.
- Returns
A GuildMember object.
- Return type
- await get_scheduled_event(_id, with_user_count=False)#
Get a scheduled event by id.
- get_scheduled_events(with_user_count=False)#
Returns an async generator of the guild scheduled events.
- Parameters
with_user_count (
bool
) – Whether to include the user count in the scheduled event.- Yields
ScheduledEvent
– The scheduled event object.
- await get_sticker(_id)#
This function is a coroutine. Returns a sticker object for the current guild and sticker IDs. Includes the
user
field if the bot has theMANAGE_EMOJIS_AND_STICKERS
permission.
- get_templates()#
This function is a coroutine. Returns an async generator of the guild templates.
- Yields
AsyncGenerator[
GuildTemplate
,None
] – The guild template object.
- get_voice_regions()#
This function is a coroutine. Returns an async generator of voice regions.
- Yields
AsyncGenerator[
VoiceRegion
,None
] – An async generator of voice regions.
- get_webhooks()#
This function is a coroutine. Returns an async generator of the guild webhooks.
- Yields
AsyncGenerator[
Webhook
, None] – The guild webhook object.
- await get_welcome_screen()#
Returns the welcome screen for the guild.
- Returns
The welcome screen for the guild.
- Return type
- await get_widget_image(style='shield')#
This function is a coroutine. Returns a PNG image widget for the guild. Requires no permissions or authentication.
Widget Style Options#
[
shield
](https://discord.com/api/guilds/81384788765712384/widget.png?style=shield) shield style widget with Discord icon and guild members online count[
banner1
](https://discord.com/api/guilds/81384788765712384/widget.png?style=banner1) large image with guild icon, name and online count. “POWERED BY DISCORD” as the footer of the widget[
banner2
](https://discord.com/api/guilds/81384788765712384/widget.png?style=banner2) smaller widget style with guild icon, name and online count. Split on the right with Discord logo[
banner3
](https://discord.com/api/guilds/81384788765712384/widget.png?style=banner3) large image with guild icon, name and online count. In the footer, Discord logo on the left and “Chat Now” on the right[
banner4
](https://discord.com/api/guilds/81384788765712384/widget.png?style=banner4) large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a “JOIN MY SERVER” button at the bottom
- param style
Style of the widget image returned
Default:"shield"
- type style
Optional[
str
]- returns
A PNG image of the guild widget.
- rtype
- await get_widget_settings()#
This function is a coroutine. Returns the guild widget settings. Requires the
MANAGE_GUILD
permission.- Returns
The guild widget settings.
- Return type
- await kick(member, reason=None)#
This function is a coroutine. Kicks a guild member.
- Parameters
member (Union[
int
,GuildMember
]) – ID or object of the guild member to kick.reason (Optional[
str
]) – Reason for the kick.
- await list_active_threads()#
This function is a coroutine. Returns all active threads in the guild, including public and private threads.
- Returns
The new member object.
- Return type
Generator[Union[
PublicThread
,PrivateThread
]], Generator[GuildMember
]]
- list_guild_members(limit=1, after=0)#
This function is a coroutine. Returns a list of guild member objects that are members of the guild.
- Parameters
limit (int) – max number of members to return (1-1000)
Default:1
after (int) – the highest user id in the previous page
Default:0
- Yields
GuildMember
– the guild member object that is in the guild- list_stickers()#
This function is a coroutine. Yields sticker objects for the current guild. Includes
user
fields if the bot has theMANAGE_EMOJIS_AND_STICKERS
permission.- Yields
Sticker
– a sticker for the current guild
- await modify_channel_positions(reason=None, *channel)#
This function is a coroutine. Create a new channel object for the guild.
- Parameters
reason (Optional[
str
]) – audit log reasonDefault:None
*channel (Dict[str, Optional[Union[int, bool,
Snowflake
]) –- await modify_current_member(nick, reason=None)#
This function is a coroutine. Modifies the current member in a guild.
- Parameters
nick (str) – value to set users nickname to
reason (Optional[
str
]) – audit log reasonDefault:None
- Returns
class – current guild member
- Return type
`~pincer.objects.guild.member.GuildMember
- await modify_current_user_voice_state(channel_id, suppress=None, request_to_speak_timestamp=None)#
This function is a coroutine. Updates the current user’s voice state.
There are currently several caveats for this endpoint: *
channel_id
must currently point to a stage channel * current user must already have joinedchannel_id
* You must have theMUTE_MEMBERS
permission tounsuppress yourself. You can always suppress yourself.
You must have the
REQUEST_TO_SPEAK
permission to request to speak. You can always clear your own request to speak.You are able to set
request_to_speak_timestamp
to any present or future time.
- Parameters
channel_id (
Snowflake
) – The ID of the channel the user is currently insuppress (Optional[
bool
]) – Toggles the user’s suppress stateDefault:None
request_to_speak_timestamp (Optional[
Timestamp
]) – Sets the user’s request to speak- await modify_scheduled_event(_id, name=None, entity_type=None, privacy_level=None, scheduled_start_time=None, scheduled_end_time=None, entity_metadata=None, channel_id=None, description=None, status=None, reason=None)#
Modify a scheduled event.
- Parameters
_id (
int
) – The id of the scheduled event.name (Optional[
str
]) – The name of the scheduled event.entity_type (Optional[
int
]) – The type of entity to be scheduled.privacy_level (Optional[
int
]) – The privacy level of the scheduled event.scheduled_start_time (Optional[
datetime
]) – The scheduled start time of the event.scheduled_end_time (Optional[
datetime
]) – The scheduled end time of the event.entity_metadata (Optional[
str
]) – The metadata of the entity to be scheduled.channel_id (Optional[
int
]) – The channel id of the channel to be scheduled.description (Optional[
str
]) – The description of the scheduled event.status (Optional[
int
]) – The status of the scheduled event.reason (Optional[
str
]) – The reason for modifying the scheduled event.
- Raises
ValueError – If the scheduled event is in the past, or if the scheduled end time is before the scheduled start time.
- Returns
The scheduled event object.
- Return type
ScheduledEvent
- await modify_user_voice_state(user, channel_id, suppress=None)#
This function is a coroutine. Updates another user’s voice state.
There are currently several caveats for this endpoint: *
channel_id
must currently point to a stage channel * User must already have joinedchannel_id
* You must have theMUTE_MEMBERS
permission.(Since suppression is the only thing that is available currently.)
When unsuppressed, non-bot users will have their
request_to_speak_timestamp
set to the current time. Bot users will not.When suppressed, the user will have their
request_to_speak_timestamp
removed.
- Parameters
user (
Member
) – The user to updatechannel_id (
Snowflake
) – The ID of the channel the user is currently insuppress (Optional[
bool
]) – Toggles the user’s suppress stateDefault:None
- await modify_welcome_screen(enabled=None, welcome_channels=None, description=None, reason=None)#
This function is a coroutine. Modifies the guild’s Welcome Screen. Requires the
MANAGE_GUILD
permission.- Parameters
enabled (Optional[
bool
]) – Whether the welcome screen is enabledDefault:None
welcome_channels (Optional[List[
WelcomeScreenChannel
]]) – Channels linked in the welcome screen and their display optionsDefault:None
description (Optional[
str
]) – The server description to show in the welcome screenDefault:None
reason (Optional[
str
]) – Reason for the modificationDefault:None
- Returns
The updated WelcomeScreen object
- Return type
- await modify_widget(reason=None, **kwargs)#
This function is a coroutine. Modifies the guild widget for the guild. Requires the
MANAGE_GUILD
permission.- Parameters
reason (Optional[
str
]) – Reason for the modificationDefault:None
**kwargs – The widget settings to modify
- Returns
The updated GuildWidget object
- Return type
- await preview()#
This function is a coroutine. Previews the guild.
- Returns
The guild preview object.
- Return type
GuildPreview
- await prune(days=7, compute_prune_days=True, include_roles=None, reason=None)#
This function is a coroutine. Prunes members from the guild. Requires the
KICK_MEMBERS
permission.Parameters
- Parameters
days (Optional[
int
]) – Number of days to prune (1-30)Default:7
compute_prune_days (Optional[
bool
]) – Whetherpruned
is returned, discouraged for large guildsDefault:True
include_roles (Optional[List[
Snowflake
]]) – role(s) to includeDefault:None
reason (Optional[
str
]) – Reason for the pruneDefault:None
- Returns
The number of members that were removed.
- Return type
- await prune_count(days=7, include_roles=None)#
This function is a coroutine. Returns the number of members that would be removed in a prune operation. Requires the
KICK_MEMBERS
permission.- Parameters
days (Optional[
int
]) – Number of days to count prune for (1-30)Default:7
include_roles (Optional[
str
]) – Comma-delimited array of Snowflakes; role(s) to includeDefault:None
- Returns
The number of members that would be removed.
- Return type
- await remove_guild_member(user_id, reason=None)#
This function is a coroutine. Remove a member from a guild.
- Parameters
user_id (int) – id of the user to remove from the guild
reason (Optional[
str
]) – audit log reasonDefault:None
- await remove_guild_member_role(user_id, role_id, reason=None)#
This function is a coroutine. Removes a role from a guild member.
- Parameters
user_id (int) – id of the user to remove a role from
role_id (int) – id of a role
reason (Optional[
str
]) – audit log reasonDefault:None
- search_guild_members(query, limit=None)#
This function is a coroutine. Returns a list of guild member objects whose username or nickname starts with a provided string.