Guild Resource¶
Note
The following classes come from the discord.resources.guild
module.
Guild
dataclass
¶
Bases: DataModel
Represents a Discord guild.
id: int
instance-attribute
¶
ID of the guild.
name: str = None
class-attribute
instance-attribute
¶
Name of the guild.
icon: str = None
class-attribute
instance-attribute
¶
Image hash of the guild's icon.
splash: str = None
class-attribute
instance-attribute
¶
Image hash of the guild's splash.
owner: Optional[bool] = None
class-attribute
instance-attribute
¶
If the member is the owner. (Get Current User Guilds)
owner_id: int = None
class-attribute
instance-attribute
¶
OD of the owner of the guild.
roles: list[int] = None
class-attribute
instance-attribute
¶
List of IDs registered in the guild.
emojis: list[EmojiModel] = None
class-attribute
instance-attribute
¶
List of emojis registered in the guild.
mfa_level: int = None
class-attribute
instance-attribute
¶
Required MFA level of the guild.
application_id: int = None
class-attribute
instance-attribute
¶
ID of the application if the guild is created by a bot.
system_channel_id: int = None
class-attribute
instance-attribute
¶
Channel ID where system messages go (e.g., welcome messages, boost events).
system_channel_flags: int = None
class-attribute
instance-attribute
¶
System channel flags.
rules_channel_id: int = None
class-attribute
instance-attribute
¶
Channel ID where rules are posted.
max_members: Optional[int] = None
class-attribute
instance-attribute
¶
Maximum member capacity for the guild.
description: str = None
class-attribute
instance-attribute
¶
Description of the guild.
banner: str = None
class-attribute
instance-attribute
¶
Image hash of the guild's banner.
preferred_locale: str = None
class-attribute
instance-attribute
¶
Preferred locale of the guild.
public_updates_channel_id: int = None
class-attribute
instance-attribute
¶
Channel ID of announcement or public updates.
approximate_member_count: int = None
class-attribute
instance-attribute
¶
Approximate number of members in the guild.
nsfw_level: int = None
class-attribute
instance-attribute
¶
NSFW level of the guild.
safety_alerts_channel_id: int = None
class-attribute
instance-attribute
¶
Channel ID for safety alerts.
fetch
async
¶
Fetch the Guild object by the given ID.
Parameters:
-
kwargs
(Unpack[FetchGuildParams]
, default:{}
) –field-specific data
Note
If no kwargs are provided, default to with_counts = False
Returns:
-
Guild
–the Guild object
fetch_channels
async
¶
create_channel
async
¶
Create a channel in this guild.
Parameters:
-
channel
(GuildChannel
) –the buildable guild channel
Returns:
-
Channel
–the created channel
fetch_guild_member
async
¶
Fetch a member in this guild.
Important
Requires the GUILD_MEMBERS privileged intent!
Parameters:
-
user_id
(int
) –user id of the member to fetch
Returns:
-
MemberModel
–member's data
fetch_guild_members
async
¶
Fetch guild members in this guild.
Important
Requires the GUILD_MEMBERS privileged intent!
Parameters:
-
**kwargs
(Unpack[FetchGuildMembersParams]
, default:{}
) –field-specific data
Note
If no kwargs are provided, default to 1 guild member limit.
Returns:
-
list[MemberModel]
–list of member data
add_guild_member_role
async
¶
Append a role to a guild member of this guild.
Parameters:
-
user_id
(int
) –id of the member for the role
-
role_id
(int
) –id of the role to append
remove_guild_member_role
async
¶
Remove a role from a guild member of this guild.
Parameters:
-
user_id
(int
) –id of the member with the role
-
role_id
(int
) –id of the role to remove
fetch_guild_role
async
¶
Fetch a role in this guild.
Parameters:
-
role_id
(int
) –id of the role to fetch
Returns:
-
RoleModel
–fetched role's data
fetch_guild_roles
async
¶
create_guild_role
async
¶
modify_guild_role
async
¶
delete_guild_role
async
¶
Delete a role in this guild.
Parameters:
-
role_id
(int
) –id of role to delete
FetchGuildParams
¶
Bases: TypedDict
Params when fetching a guild.
with_counts: Optional[bool]
instance-attribute
¶
If True, return the approximate member and presence counts for the guild.