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.
idThe id of this emoji.nameThe name of this emoji.rolesA list of role ids who can use this role.require_colonsWhether or not this emoji must be wrapped in colons.managedWhether 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)
idThe id of the integration.nameThe name of the integration.typeIntegration type; youtube, twitch, etc.enabledWhether or not the integration is enabled.syncingWhether or not the integration is syncing.role_idThe id of the role associated with "subscribers" to this integration.expire_behaviourThe behaviour of expiring subscribers.expire_grace_periodThe grace period before expiring subscribers.userThe user for this integration.accountThe integration's account information.synced_atWhen this integration was last synced.
integration_account()
Specs
Represents the account of an integration.
idThe id of the account.nameThe 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.
userA user struct containing information about the underlying user.nickAn optional nickname for this member.rolesA list of ids corresponding to roles the member has.joined_atThe timestamp of when this member joined the guild.deafWhether the user is currently deafened.muteWhether 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.
userThe user this presence is for.rolesA list of role ids this user belongs to.gameThe current activity of the user, ornil.guild_idThe 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.
idThe id of the role.nameThe name of the role.colorThe color of the role.hoistWhether the role is "hoisted" above others in the sidebar.positionThe position of the role in a guild.permissionsThe bitset of permissions for this role. See thePermissionsmodule for more information.managedWhether this role is managed by an integration.mentionableWhether 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.
idThe id of this guild.
nameThe name of this guild.
iconThe image hash of the icon image.splashThe image hash of the splash image. Not a lot of guilds have a hash.owner_idThe user id of the guild's owner.regionThe region of the guild.afk_channel_idThe id of the afk channel, if the guild has one.afk_timeoutThe afk timeout in seconds.embed_enabledWhether this guild is embeddable.verification_levelThe level of verification this guild requires.default_message_notificationsThe default message notifications level.rolesA list of the roles in this server.emojisA list of custom emojis in this server.featuresA list of guild features.mfa_levelThe required mfa level for the guild.
The following fields will be missing for guilds accessed from outside the Cache:
joined_atThe timestamp of guild creation.largeWhether or not this guild is considered "large".unavailableThis should never be true for guilds.member_countThe number of members a guild contains.voice_statesA list of voice states of the guild.membersA list of members in the guild.channelsA list of channels in the guild.presencesA 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, anArgumentErroris raised.