Resources¶
guild
¶
Guild
dataclass
¶
Bases: BaseResource
flowchart TD
scurrypy.resources.guild.Guild[Guild]
scurrypy.resources.base_resource.BaseResource[BaseResource]
scurrypy.resources.base_resource.BaseResource --> scurrypy.resources.guild.Guild
click scurrypy.resources.guild.Guild href "" "scurrypy.resources.guild.Guild"
click scurrypy.resources.base_resource.BaseResource href "" "scurrypy.resources.base_resource.BaseResource"
Represents a Discord guild resource.
id: Snowflake
instance-attribute
¶
ID of the guild.
fetch
async
¶
Fetch the Guild object by the given ID.
Parameters:
-
with_counts(bool, default:False) –return the approximate member and presence counts for the guild. Defaults to
False.
Returns:
-
JsonQuery–queried guild
edit
async
¶
Edit this guild.
Fires Guild Update.
Parameters:
-
options(EditGuildParams) –fields to edit
Returns:
-
JsonQuery–edited guild
fetch_channels
async
¶
Fetch this guild's channels.
Note
Does not include threads!
Returns:
-
JsonQuery–queried list of the guild's channels
fetch_active_threads
async
¶
Fetch all active threads in a guild (private and public).
Note
Threads are ordered by their ID in descending order.
Returns:
-
JsonQuery–active guild threads
create_channel
async
¶
Create a channel in this guild.
Fires Channel Create.
Permissions
Requires MANAGE_CHANNELS
Parameters:
-
channel(GuildChannelCreate) –the guild channel to create
Returns:
-
JsonQuery–created channel
fetch_member
async
¶
fetch_members
async
¶
Fetch guild members in this guild.
Important
Requires the GUILD_MEMBERS privileged intent!
Parameters:
-
limit(int, default:1) –Max number of members to return. Range 1 - 1000 (inclusive). Default
1. -
after(Snowflake, default:None) –highest user ID in previous page
Returns:
-
JsonQuery–queried list of guild members
add_member_role
async
¶
Append a role to a guild member of this guild.
Fires Guild Member Update.
Permissions
Requires MANAGE_ROLES
Parameters:
remove_member_role
async
¶
Remove a role from a guild member of this guild.
Fires Guild Member Update.
Permissions
Requires MANAGE_ROLES
Parameters:
search_members
async
¶
Fetch guild members whose username or nickname starts with the provided query.
Parameters:
-
query(str) –query string to match against
-
limit(int, default:1) –Max number of members to return. Max
1000. Defaults to1.
Returns:
-
JsonQuery–queried list of guild members
edit_member
async
¶
Edit a guild member's attributes.
Fires Guild Member Update.
Parameters:
-
user_id(Snowflake) –ID of the member to edit
-
options(EditGuildMemberParams) –fields to edit
Returns:
-
JsonQuery–edited guid member
remove_member
async
¶
Remove a member from this guild.
Fires Guild Member Remove.
Permissions
Requires KICK_MEMBERS
Parameters:
-
user_id(Snowflake) –ID of the user to kick
fetch_ban
async
¶
fetch_bans
async
¶
Fetch bans in this guild.
Permissions
Requires BAN_MEMBERS
Note
If before and after are provided, only before is respected.
Parameters:
-
limit(int, default:1000) –max number of users to return. Defaults to
1000. -
before(Snowflake, default:None) –fetch users before this ID
-
after(Snowflake, default:None) –fetch users after this ID
Returns:
-
JsonQuery–queried list of guild bans in ascending order by user ID
create_ban
async
¶
Create a guild ban and optionally delete messages sent by the banned user.
Fires Guild Ban Add.
Permissions
Requires BAN_MEMBERS
Parameters:
-
user_id(Snowflake) –ID of the user to ban
-
delete_message_seconds(int, default:0) –seconds back to delete messages. Range
0to604800(7 days). Defaults to0.
remove_ban
async
¶
Remove the ban for a user.
Fires Guild Ban Remove.
Permissions
Requires BAN_MEMBERS
Parameters:
-
user_id(Snowflake) –ID of the user in which to remove the ban
bulk_create_ban
async
¶
Create guild bans and optionally delete messages sent by the banned users.
Permissions
Requires BAN_MEMBERS and MANAGE_GUILD
Parameters:
-
bulk_ban(BulkGuildBanPart) –bulk ban to create
Returns:
-
JsonQuery–bulk ban response
fetch_role_member_counts
async
¶
Fetch a map of role IDs to number of members with the role.
Note
Does not include @everyone role.
Returns:
-
JsonQuery–map of role IDs to member count
fetch_role
async
¶
create_role
async
¶
Create a role in this guild.
Fires Role Create.
Permissions
Requires MANAGE_ROLES
Parameters:
-
role(GuildRolePart) –fields to create a role
Returns:
-
JsonQuery–created role
edit_role
async
¶
Edit a role in this guild.
Fires Role Update.
Permissions
Requires MANAGE_ROLES
Parameters:
-
role_id(Snowflake) –ID of role to edit
-
options(EditGuildRoleParams) –fields to edit
Returns:
-
JsonQuery–edited role
delete_role
async
¶
Delete a role in this guild.
Fires Role Delete.
Permissions
Requires MANAGE_ROLES
Parameters:
-
role_id(Snowflake) –ID of role to delete
fetch_invites
async
¶
Fetch this guild's invites with no metadata.
Permissions
Requires MANAGE_GUILD or VIEW_AUDIT_LOG
Note
Invite metadata is only include with MANAGE_GUILD permission.
Returns:
-
JsonQuery–queried list of invites
fetch_invites_with_metadata
async
¶
Fetch this guild's invites with metadata.
Permissions
Requires MANAGE_GUILD and MANAGE_GUILD or VIEW_AUDIT_LOG
Returns:
-
JsonQuery–queried list of invites with metadata
fetch_integrations
async
¶
Fetch this guild's integrations.
Permissions
Requires MANAGE_GUILD
Returns:
-
JsonQuery–queried integrations
delete_integration
async
¶
Delete the attached integration object for this guild.
Fires Integration Update and Integration Delete.
Permissions
Requires MANAGE_GUILD
Parameters:
-
integration_id(Snowflake) –ID of the integration to delete
fetch_welcome_screen
async
¶
Fetch the welcome screen for this guild.
Permissions
Requires MANAGE_GUILD if welcome screen is not enabled
Returns:
-
JsonQuery–queried welcome screen
edit_welcome_screen
async
¶
Edit this guild's welcome screen. May fire Guild Update.
Permissions
Requires MANAGE_GUILD
Parameters:
-
options(EditGuildWelcomeScreen) –fields to edit
Returns:
-
JsonQuery–edited welcome screen
fetch_onboarding
async
¶
edit_onboarding
async
¶
Modifies this guild's onboarding flow.
Permissions
Requires MANAGE_GUILD and MANAGE_ROLES
Note
Must be at least 7 Default Channels and at least 5 allow sending message to the @everyone role.
Constraints depend on the new mode.
Parameters:
-
options(EditOnboardingParams) –onboarding field to edit
Returns:
-
JsonQuery–edited onboarding flow
fetch_sticker
async
¶
fetch_stickers
async
¶
Fetch this guild's stickers.
Note
Includes the user field if the bot has
CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS
Returns:
-
JsonQuery–queried guild stickers
create_sticker
async
¶
Add a sticker to this guild.
Fires Guild Stickers Update.
Permissions
Requires CREATE_GUILD_EXPRESSIONS
Parameters:
-
sticker(GuildStickerPart) –sticker to create
-
file(ImageAssetPart) –the sticker file to upload
Note
Accepted file types: PNG, APNG, GIF, Lottie JSON file.
Note
Animated stickers are restricted to a max of 5 seconds.
Note
Lottie stickers are only usable if the guild has
VERIFIEDorPARTNEREDguild feature.
Returns:
-
JsonQuery–created sticker
edit_sticker
async
¶
Edit a sticker from this guild.
Fires Guild Stickers Update.
Permissions
Requires CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS if created by the bot.
Requires MANAGE_GUILD_EXPRESSIONS if not created by the bot.
Parameters:
-
sticker_id(Snowflake) –ID of the sticker to delete
-
options(EditGuildStickerParams) –fields to edit
Returns:
-
JsonQuery–edited sticker
delete_sticker
async
¶
Delete a sticker from this guild.
Fires Guild Stickers Update.
Permissions
Requires CREATE_GUILD_EXPRESSIONS or MANAGE_GUILD_EXPRESSIONS if created by the bot.
Requires MANAGE_GUILD_EXPRESSIONS if not created by the bot.
Parameters:
-
sticker_id(Snowflake) –ID of the sticker to delete