Guild class

Guild object represents single Discord Server. Guilds are a collection of members, channels, and roles that represents one community.


channels property is Map of Channels but it can be cast to specific Channel subclasses. Example with getting all CachelessTextChannels in Guild:

var textChannels = channels.where((channel) => channel is MessageChannel) as List<TextChannel>;

If you want to get icon or splash of Guild use iconURL() method - icon property returns only hash, same as splash property.

Inheritance
Implemented types

Properties

afkChannel VoiceChannel
The guild's afk channel ID, null if not set.
read / write
afkTimeout int
The guild's AFK timeout.
read / write, final, late
available bool
Whether or not the guild is available.
read / write, final, late
channels ChannelCache
The guild's channels.
read / write, final, late
client Nyxx
Reference to Nyxx instance
read / write
createdAt DateTime
Gets creation timestamp included in Snowflake
read-only, inherited
currentUserPermissions Permissions
Permission of current(bot) user in this guild
read / write
discoverySplash String
Discovery splash hash
read / write
embedChannel CacheGuildChannel
The channel ID for the guild's widget if enabled.
read / write, final, late
embedEnabled bool
If the guild's widget is enabled.
read / write, final, late
emojis Cache<Snowflake, IGuildEmoji>
Guild custom emojis
read / write, final, late
everyoneRole IRole
Getter for @everyone role
read-only
features Iterable<GuildFeature>
enabled guild features
read / write, final, late
fileUploadLimit int
File upload limit for channel in bytes.
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
icon String
The guild's icon hash.
read / write
id Snowflake
ID of entity as Snowflake
final, inherited
members Cache<Snowflake, IMember>
The guild's members.
read / write, final, late
mfaLevel int
The guild's MFA level.
read / write, final, late
name String
The guild's name.
read / write, final, late
notificationLevel int
The guild's notification level.
read / write, final, late
owner User
The guild owner's ID
read / write, final, late
preferredLocale String
the preferred locale of a "PUBLIC" guild used in server discovery and notices from Discord; defaults to "en-US"
read / write, final, late
premiumSubscriptionCount int
The number of boosts this server currently has
read / write, final, late
premiumTier PremiumTier
Boost level of guild
read / write, final, late
publicUpdatesChannel IGuildChannel
the id of the channel where admins and moderators of "PUBLIC" guilds receive notices from Discord
read / write, final, late
region String
The guild's voice region.
read / write
roles Cache<Snowflake, IRole>
The guild's roles.
read / write, final, late
rulesChannel IGuildChannel
Channel where "PUBLIC" guilds display rules and/or guidelines
read / write, final, late
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
selfMember IMember
Returns member object for bot user
read-only
shard Shard
Returns this guilds shard
read-only
splash String
Splash hash
read / write
systemChannel CachelessTextChannel
System channel where system messages are sent
read / write, final, late
systemChannelFlags int
System Channel Flags
read / write, final, late
url String
Returns url to this guild.
read-only
verificationLevel int
The guild's verification level.
read / write, final, late
voiceStates Cache<Snowflake, VoiceState>
Users state cache
read / write, final, late

Methods

addRoleToMember(CacheMember user, Role role) Future<void>
Adds Role to CacheMember [...]
ban(SnowflakeEntity user, {int deleteMessageDays: 0, String auditReason}) Future<void>
Bans a user and allows to delete messages from deleteMessageDays number of days. [...]
changeOwner(CacheMember member, {String auditReason}) Future<Guild>
Change guild owner.
changeSelfNick(String nick) Future<void>
Change self nickname in guild
createChannel(String name, ChannelType type, {int bitrate, String topic, CategoryChannel parent, bool nsfw, int userLimit, PermissionsBuilder permissions, String auditReason}) Future<CacheGuildChannel>
Creates a channel. Returns null when type is DM or GroupDM. Also can be null if type is Guild Group channel and parent is specified. [...]
createEmoji(String name, {List<Role> roles, File image, List<int> imageBytes}) Future<GuildEmoji>
Allows to create new guild emoji. name is required and you have to specify one of two other parameters: image or imageBytes. imageBytes can be useful if you want to create image from http response. [...]
createInvite({int maxAge: 0, int maxUses: 0, bool temporary: false, bool unique: false, String auditReason}) Future<Invite>
Creates invite in first channel possible
createRole(RoleBuilder roleBuilder, {String auditReason}) Future<Role>
Creates new role [...]
delete() Future<void>
Deletes the guild.
discoveryURL({String format: "webp", int size: 128}) String
URL to guild"s splash. If guild doesn"t have splash it returns null.
dispose() Future<void>
Perform cleanup
override
edit({String name, int verificationLevel, int notificationLevel, CacheVoiceChannel afkChannel, int afkTimeout, String icon, String auditReason}) Future<Guild>
Edits the guild.
editGuildEmbed(EmbedBuilder embed, {String auditReason}) Future<Embed>
Modify guild embed object
getAuditLogs({Snowflake userId, int actionType, Snowflake before, int limit}) Future<AuditLog>
Returns Audit logs. https://discordapp.com/developers/docs/resources/audit-log [...]
getBan(Snowflake id) Future<Ban>
Gets single Ban object for given id
getBans() Stream<Ban>
Get"s the guild's bans.
getEmoji(Snowflake emojiId, [bool useCache = true]) Future<GuildEmoji>
Gets Guild Emoji based on Id [...]
getGuildEmbed() Future<Embed>
Get Guild"s embed object
getGuildInvites() Stream<Invite>
Returns list of Guilds invites
getMember(User user) Future<IMember>
Gets a CacheMember object. Caches fetched member if not cached. [...]
getMemberById(Snowflake id) Future<IMember>
Gets a CacheMember object by id. Caches fetched member if not cached. [...]
getMembers({int limit: 1, Snowflake after}) Stream<CacheMember>
Allows to fetch guild members. In future will be restricted with Priviliged Intents. after is used to continue from specified user id. By default limits to one user - use limit paramter to change that behavior.
getVoiceRegions() Stream<VoiceRegion>
Returns list of available CacheVoiceChannels
getWebhooks() Stream<Webhook>
Gets all of the webhooks for this channel.
guildWidgetUrl([String style = "shield"]) String
Allows to download Guild widget aka advert png Possible options for style: shield (default), banner1, banner2, banner3, banner4
iconURL({String format: "webp", int size: 128}) String
The guild"s icon, represented as URL. If guild doesn"t have icon it returns null.
kick(SnowflakeEntity user, {String auditReason}) Future<void>
Kicks user from guild. Member is removed from guild and he is able to rejoin [...]
leave() Future<void>
Leaves the guild.
moveChannel(CacheGuildChannel channel, {int absolute, int relative, String auditReason}) Future<void>
Moves channel. Allows to move channel by absolute about with absolute or relatively with relative parameter. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
prune(int days, {Iterable<Snowflake> includeRoles, String auditReason}) Future<int>
Prunes the guild, returns the amount of members pruned. https://discordapp.com/developers/docs/resources/guild#get-guild-prune-count
pruneCount(int days, {Iterable<Snowflake> includeRoles}) Future<int>
Returns int indicating the number of members that would be removed in a prune operation.
searchMembers(String query, {int limit: 1}) Stream<CacheMember>
Returns a Stream of CacheMember objects whose username or nickname starts with a provided string. By default limits to one entry - can be changed with limit parameter.
searchMembersGateway(String query, {int limit: 0}) Stream<IMember>
Returns a Stream of CacheMember objects whose username or nickname starts with a provided string. By default limits to one entry - can be changed with limit parameter.
splashURL({String format: "webp", int size: 128}) String
URL to guild"s splash. If guild doesn"t have splash it returns null.
toString() String
Returns a string representation of this object - Guild name.
override
unban(Snowflake id) Future<void>
Unbans a user by ID.

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited