Alchemy.Guild (alchemy v0.7.0)
Guilds represent a collection of users in a "server". This module contains information about the types, and subtypes related to guilds, as well as some useful functions related to them.
Link to this section Summary
Types
Represents a custom emoji in a guild.
Represents an guild's integration with a service, (i.e. twitch)
Represents the account of an integration.
Represents a member in a guild.
Represents the presence of a user in a guild.
Represents a role in a guild.
Represents a guild.
An iso_8601 timestamp.
Functions
Finds the highest ranked role of a member in a guild.
Get the icon image URL for the given guild.
If the guild does not have any icon, returns nil
.
Link to this section Types
emoji()
Specs
emoji() :: %Alchemy.Guild.Emoji{ id: String.t(), managed: Boolean, name: String.t(), require_colons: Boolean, roles: [String.t()] }
Represents a custom emoji in a guild.
The string representation of this struct will be the markdown
necessary to use it. i.e. Cogs.say("#{emoji}")
will send the emoji.
id
The id of this emoji.name
The name of this emoji.roles
A list of role ids who can use this role.require_colons
Whether or not this emoji must be wrapped in colons.managed
Whether or not this emoji is managed.
integration()
Specs
integration() :: %Alchemy.Guild.Integration{ account: integration_account(), enabled: Boolean, expire_behaviour: Integer, expire_grace_period: Integer, id: snowflake(), name: String.t(), role_id: snowflake(), synced_at: timestamp(), syncing: Boolean, type: String.t(), user: Alchemy.User.t() }
Represents an guild's integration with a service, (i.e. twitch)
id
The id of the integration.name
The name of the integration.type
Integration type; youtube, twitch, etc.enabled
Whether or not the integration is enabled.syncing
Whether or not the integration is syncing.role_id
The id of the role associated with "subscribers" to this integration.expire_behaviour
The behaviour of expiring subscribers.expire_grace_period
The grace period before expiring subscribers.user
The user for this integration.account
The integration's account information.synced_at
When this integration was last synced.
integration_account()
Specs
Represents the account of an integration.
id
The id of the account.name
The name of the account.
member()
Specs
member() :: %Alchemy.Guild.GuildMember{ deaf: Boolean, joined_at: timestamp(), mute: Boolean, nick: String.t() | nil, roles: [snowflake()], user: Alchemy.User.t() }
Represents a member in a guild.
user
A user struct containing information about the underlying user.nick
An optional nickname for this member.roles
A list of ids corresponding to roles the member has.joined_at
The timestamp of when this member joined the guild.deaf
Whether the user is currently deafened.mute
Whether the user is currently muted.
presence()
Specs
presence() :: %Alchemy.Guild.Presence{ game: String.t() | nil, guild_id: snowflake(), roles: [snowflake()], status: String.t(), user: Alchemy.User.t() }
Represents the presence of a user in a guild.
user
The user this presence is for.roles
A list of role ids this user belongs to.game
The current activity of the user, ornil
.guild_id
The id of the guild this presences is in.status
"idle", "online", or "offline"
role()
Specs
role() :: %Alchemy.Guild.Role{ color: Integer, hoist: Boolean, id: snowflake(), managed: Boolean, mentionable: Boolean, name: String.t(), permissions: Integer, position: Integer }
Represents a role in a guild.
id
The id of the role.name
The name of the role.color
The color of the role.hoist
Whether the role is "hoisted" above others in the sidebar.position
The position of the role in a guild.permissions
The bitset of permissions for this role. See thePermissions
module for more information.managed
Whether this role is managed by an integration.mentionable
Whether this role is mentionable.
snowflake()
Specs
snowflake() :: String.t()
Specs
t() :: %Alchemy.Guild{ afk_channel_id: String.t() | nil, afk_timeout: Integer, channels: [Alchemy.Channel.t()], default_message_notifications: Integer, embed_enabled: Boolean, emojis: [emoji()], features: [String.t()], icon: String.t(), id: snowflake(), joined_at: timestamp(), large: Boolean, member_count: Integer, members: [member()], mfa_level: Integer, name: String.t(), owner_id: snowflake(), presences: [Alchemy.Guild.Presence.t()], region: String.t(), roles: [Guild.role()], splash: String.t() | nil, unavailable: Boolean, verification_level: Integer, voice_states: [Alchemy.Voice.state()] }
Represents a guild.
id
The id of this guild.
name
The name of this guild.
icon
The image hash of the icon image.splash
The image hash of the splash image. Not a lot of guilds have a hash.owner_id
The user id of the guild's owner.region
The region of the guild.afk_channel_id
The id of the afk channel, if the guild has one.afk_timeout
The afk timeout in seconds.embed_enabled
Whether this guild is embeddable.verification_level
The level of verification this guild requires.default_message_notifications
The default message notifications level.roles
A list of the roles in this server.emojis
A list of custom emojis in this server.features
A list of guild features.mfa_level
The required mfa level for the guild.
The following fields will be missing for guilds accessed from outside the Cache:
joined_at
The timestamp of guild creation.large
Whether or not this guild is considered "large".unavailable
This should never be true for guilds.member_count
The number of members a guild contains.voice_states
A list of voice states of the guild.members
A list of members in the guild.channels
A list of channels in the guild.presences
A list of presences in the guild.
timestamp()
Specs
timestamp() :: String.t()
An iso_8601 timestamp.
Link to this section Functions
highest_role(guild, member)
Specs
Finds the highest ranked role of a member in a guild.
This is useful, because the permissions and color of the highest role are the ones that apply to that member.
icon_url(guild, type \\ "png", size \\ 256)
Specs
Get the icon image URL for the given guild.
If the guild does not have any icon, returns nil
.
Parameters
type
: The returned image format. Can be any ofjpg
,jpeg
,png
, orwebp
.size
: The desired size of the returned image. Must be a power of two. If the parameters do not match these conditions, anArgumentError
is raised.