Guild - truemedian/Discordia GitHub Wiki
Inherits Snowflake
Represents a Discord guild (or server). Guilds are a collection of members, channels, and roles that represents one community.
requestMembers
sync
getMember
getMember
getEmoji
getChannel
createTextChannel
createVoiceChannel
createCategory
createRole
createEmoji
setName
setRegion
setVerificationLevel
setNotificationSetting
setExplicitContentSetting
setAFKTimeout
setAFKChannel
setSystemChannel
setOwner
setIcon
setSplash
getPruneCount
pruneMembers
getBans
getInvites
getAuditLogs
getWebhooks
listVoiceRegions
leave
delete
kickUser
banUser
unbanUser
shardId
name
icon
iconURL
splash
splashURL
large
region
mfaLevel
joinedAt
afkTimeout
unavailable
totalMemberCount
verificationLevel
notificationSetting
explicitContentSetting
features
me
owner
ownerId
afkChannelId
afkChannel
systemChannelId
systemChannel
defaultRole
roles
emojis
members
textChannels
voiceChannels
categories
Asynchronously loads all members for this guild. You do not need to call this if the
cacheAllMembers
client option (and thesyncGuilds
option for user-accounts) is enabled on start-up.Returns: boolean
Asynchronously loads certain data and enables the receiving of certain events for this guild. You do not need to call this if the
syncGuilds
client option is enabled on start-up. Note: This is only for user accounts. Bot accounts never need to sync guilds!Returns: boolean
Gets a member object by ID. If the object is already cached, then the cached object will be returned; otherwise, an HTTP request is made.
Name Type id User ID Resolvable Returns: Member
Gets a role object by ID.
Name Type id User ID Resolvable Returns: Member
Gets a emoji object by ID.
Name Type id Emoji ID Resolvable Returns: Emoji
Gets a text, voice, or category channel object by ID.
Name Type id Channel ID Resolvable Returns: GuildChannel
Creates a new text channel in this guild. The name must be between 2 and 100 characters in length.
Name Type name string Returns: GuildTextChannel
Creates a new voice channel in this guild. The name must be between 2 and 100 characters in length.
Name Type name string Returns: GuildVoiceChannel
Creates a channel category in this guild. The name must be between 2 and 100 characters in length.
Name Type name string Returns: GuildCategoryChannel
Creates a new role in this guild. The name must be between 1 and 100 characters in length.
Name Type name string Returns: Role
Creates a new emoji in this guild. The name must be between 2 and 32 characters in length. The image must not be over 256kb, any higher will return a 400 Bad Request
Name Type name string image Base64 Resolvable Returns: Emoji
Sets the guilds name. This must be between 2 and 100 characters in length.
Name Type name string Returns: boolean
Sets the guild's voice region (eg:
us-east
). SeelistVoiceRegions
for a list of acceptable regions.
Name Type region string Returns: boolean
Sets the guild's verification level setting. See the
verificationLevel
enumeration for acceptable values.
Name Type verification_level number Returns: boolean
Sets the guild's default notification setting. See the
notficationSetting
enumeration for acceptable values.
Name Type default_message_notifications number Returns: boolean
Sets the guild's explicit content level setting. See the
explicitContentLevel
enumeration for acceptable values.
Name Type explicit_content_filter number Returns: boolean
Sets the guild's AFK timeout in seconds.
Name Type afk_timeout number Returns: number
Sets the guild's AFK channel.
Name Type id Channel ID Resolvable Returns: boolean
Transfers ownership of the guild to another user. Only the current guild owner can do this.
Name Type id Channel Id Resolvable Returns: boolean
Transfers ownership of the guild to another user. Only the current guild owner can do this.
Name Type id User ID Resolvable Returns: boolean
Sets the guild's icon. To remove the icon, pass
nil
.
Name Type icon Base64 Resolvable Returns: boolean
Sets the guild's splash. To remove the splash, pass
nil
.
Name Type splash Base64 Resolvable Returns: boolean
Returns the number of members that would be pruned from the guild if a prune were to be executed.
Name Type Optional days number x Returns: number
Prunes (removes) inactive, roleless members from the guild.
Name Type Optional days number x Returns: number
Returns a newly constructed cache of all ban objects for the guild. The cache is not automatically updated via gateway events, but the internally referenced user objects may be updated. You must call this method again to guarantee that the objects are up to date.
Returns: Cache
Returns a newly constructed cache of all invite objects for the guild. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects.
Returns: Cache
Returns a newly constructed cache of audit log entry objects for the guild. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects. - query.limit: number - query.user: UserId Resolvable - query.before: EntryId Resolvable - query.type: ActionType Resolvable
Name Type Optional query table x Returns: Cache
Returns a newly constructed cache of all webhook objects for the guild. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects.
Returns: Cache
Returns a raw data table that contains a list of available voice regions for this guild, as provided by Discord, with no additional parsing.
Returns: table
Removes the current user from the guild.
Returns: boolean
Permanently deletes the guild. This cannot be undone!
Returns: boolean
Kicks a user/member from the guild with an optional reason.
Name Type Optional id User ID Resolvable reason string x Returns: boolean
Bans a user/member from the guild with an optional reason. The
days
parameter is the number of days to consider when purging messages, up to 7.
Name Type Optional Optional id User ID Resolvable reason string x days number x Returns: boolean
Unbans a user/member from the guild with an optional reason.
Name Type Optional id User ID Resolvable reason string x Returns: boolean
The ID of the shard on which this guild is served. If only one shard is in operation, then this will always be 0.
Type: number
The guild's name. This should be between 2 and 100 characters in length.
Type: string
The hash for the guild's custom icon, if one is set.
Type: string|nil
The URL that can be used to view the guild's icon, if one is set.
Type: string|nil
The hash for the guild's custom splash image, if one is set. Only partnered guilds may have this.
Type: string|nil
The URL that can be used to view the guild's custom splash image, if one is set. Only partnered guilds may have this.
Type: string|nil
Whether the guild has an arbitrarily large amount of members. Guilds that are "large" will not initialize with all members.
Type: boolean
The voice region that is used for all voice connections in the guild.
Type: string
The guild's multi-factor (or two-factor) verification level setting. A value of 0 indicates that MFA is not required; a value of 1 indicates that MFA is required for administrative actions.
Type: number
The date and time at which the current user joined the guild, represented as an ISO 8601 string plus microseconds when available.
Type: string
The guild's voice AFK timeout in seconds.
Type: number
Whether the guild is unavailable. If the guild is unavailable, then no property is guaranteed to exist except for this one and the guild's ID.
Type: boolean
The total number of members that belong to this guild. This should always be greater than or equal to the total number of cached members.
Type: number
The guild's verification level setting. See the
verificationLevel
enumeration for a human-readable representation.Type: number
The guild's default notification setting. See the
notficationSetting
enumeration for a human-readable representation.Type: number
The guild's explicit content level setting. See the
explicitContentLevel
enumeration for a human-readable representation.Type: number
Raw table of VIP features that are enabled for the guild.
Type: table
Equivalent to
Guild.members:get(Guild.client.user.id)
.Type: Member|nil
Equivalent to
Guild.members:get(Guild.ownerId)
.Type: Member|nil
The Snowflake ID of the guild member that owns the guild.
Type: string
The Snowflake ID of the channel that is used for AFK members, if one is set.
Type: string|nil
Equivalent to
Guild.voiceChannels:get(Guild.afkChannelId)
.Type: GuildVoiceChannel|nil
The channel id where Discord's join messages will be displayed
Type: string|nil
The channel where Discord's join messages will be displayed
Type: GuildTextChannel|nil
Equivalent to
Guild.roles:get(Guild.id)
.Type: Role
An iterable cache of all roles that exist in this guild. This includes the default everyone role.
Type: Cache
An iterable cache of all emojis that exist in this guild. Note that standard unicode emojis are not found here; only custom emojis.
Type: Cache
An iterable cache of all members that exist in this guild and have been already loaded. If the
cacheAllMembers
client option (and thesyncGuilds
option for user-accounts) is enabled on start-up, then all members will be cached. Otherwise, offline members may not be cached. To access a member that may exist, but is not cached, useGuild:getMember
.Type: Cache
An iterable cache of all text channels that exist in this guild.
Type: Cache
An iterable cache of all voice channels that exist in this guild.
Type: Cache
An iterable cache of all channel categories that exist in this guild.
Type: Cache
Inherited from Container
A shortcut to the client object to which this container is visible.
Type: Client
The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.
Type: Container|Client
Inherited from Snowflake
The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent.
Type: string
The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate.
Type: number
The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available.
Equivalent to Date.fromSnowflake(Snowflake.id):toISO()
.
Type: string