nyxx library
Nyxx Discord API wrapper for Dart
Main library which contains all stuff needed to connect and interact with Discord API.
Classes
- Activity
- Presence is game or activity which user is playing/user participate. Can be game, eg. Dota 2, VS Code or activity like Listening to song on Spotify.
- ActivityBuilder
- Allows to change status and presence of bot
- ActivityEmoji
- Represent emoji within activity
- ActivityFlags
- Flags of the activity
- ActivityParty
- Represents party of game.
- ActivityTimestamps
- Timestamp of activity
- ActivityType
- Represents type of presence activity
- AllowedMentions
- The allowed mention field allows for more granular control over mentions without various hacks to the message content. This will always validate against message content to avoid phantom pings (e.g. to ping everyone, you must still have @everyone in the message content), and check against user/bot permissions.
- AppTeam
- Object of team that manages given app
- AppTeamMember
- Represent membership of user in AppTeam
- AppTeamUser
- Represent user in AppTeamMember context
- Attachment
- A message attachment.
- AttachmentBuilder
- Helper for sending attachment in messages. Allows to create attachment from path, File or bytes.
- AuditLog
- Whenever an admin action is performed on the API, an entry is added to the respective guild's audit log.
- AuditLogChange
- Represents change made in guild with old and new value
- AuditLogEntry
- Single entry of Audit Log
- AuditLogEntryType
- Ban
- Ban object. Has attached reason of ban and user who was banned.
- BasicRequest
- BasicRequest with json body
- Builder
- Provides abstraction for builders
- BuilderUtility
- A utility to run .build() on internal functions
- BuilderWithClient
- Provides abstraction for builders
-
Cache<
T, S> - Generic interface for caching entities. Wraps Map interface and provides utilities for manipulating cache.
-
Cacheable<
T extends Snowflake, S extends SnowflakeEntity> -
Wraps SnowflakeEntity that can be taken from cache or optionally downloaded from API.
Always provides id of entity.
download()
method tries to get entity from API and returns it upon success or throws Error if something happens in the process. -
CacheableTextChannel<
S extends TextChannel> - Lightweight channel which implements cacheable and allows to perform basic operation on channel instance
- CacheOptions
- Options for configuring cache. Allows to specify where and which entities should be cached and preserved in cache
-
CachePolicy<
T extends SnowflakeEntity> - CachePolicy is set of rules which will decide if entity should be cached.
- CachePolicyLocation
- Describes in which places entity should be cached
- CacheUtility
- Cache Utility is a Utility that lets you retrieve Entities (from the cache) from outside of the nyxx project. Typically used in nyxx.* projects. An example getting a user is below:
- CategoryGuildChannel
- ChangeKeyType
- Type of change in audit log
- ChannelBuilder
- Builder for creating mini channel instance
- ChannelCache
- Cache for Channels
- ChannelCachePolicy
- Cache policies for caching channels
- ChannelCreateEvent
- Sent when a channel is created.
- ChannelDeleteEvent
- Sent when a channel is deleted.
- ChannelPinsUpdateEvent
- Fired when channel"s pinned messages are updated
- ChannelType
- Enum for possible channel types
- ChannelUpdateEvent
- Sent when a channel is updated.
- ClientOAuth2Application
- The client's OAuth2 app, if the client is a bot.
- ClientOptions
- Optional client settings which can be used when creating new instance of client. It allows to tune up client to your needs.
- ClientStatus
- Provides status of user on different devices
- ClientUser
- ClientUser is bot's discord account. Allows to change bot's presence.
- ComponentStyle
- Style for a button.
- ComponentType
- Type of interaction component
- Constants
- The client constants.
-
Convertable<
T> - Specifies objects which can be converted to Builder
- DisconnectEvent
- Sent when a shard disconnects from the websocket.
- DisconnectEventReason
- Reason why shard was disconnected.
- DiscordColor
- Wrapper for colors. Simplifies creation and provides interface to interact with colors for nyxx.
- Disposable
- Provides abstraction for disposing object's resources when isn't needed anymore
- DMChannel
- Represents private channel with user
- DMMessage
- Message that is sent in dm channel or group dm channel
- Embed
- A message embed. Can contain null elements.
- EmbedAuthor
- Author of embed. Can contain null elements.
- EmbedAuthorBuilder
- Build new instance of author which can be used in EmbedBuilder
- EmbedBuilder
- Builds up embed object.
- EmbedField
- Single instance of Embed's field. Can contain null elements.
- EmbedFieldBuilder
- Builder for embed Field.
- Embed's footer. Can contain null elements.
- Build new instance of Embed's footer
- EmbedProvider
- A message embed provider.
- EmbedThumbnail
- A message embed thumbnail.
- EmbedVideo
- Video attached to embed. Can contain null elements.
- EntityUtility
- Entity Utility is a Utility that lets you create Entities from outside of the nyxx project. Typically used in nyxx.* projects. An example getting a user is below:
- GameAssets
- Presence"s assets
- GameSecrets
- Represents presence"s secrets
- GatewayIntents
- When identifying to the gateway, you can specify an intents parameter which allows you to conditionally subscribe to pre-defined "intents", groups of events defined by Discord. If you do not specify a certain intent, you will not receive any of the gateway events that are batched into that group. Reference
- Guild
- GuildBanAddEvent
- Sent when a member is banned.
- GuildBanRemoveEvent
- Sent when a user is unbanned from a guild.
- GuildBuilder
- Allows to build guild object for creating new one or modifying existing
- GuildChannel
- Represents channel within Guild. Shares logic for both TextGuildChannel and VoiceGuildChannel.
- GuildCreateEvent
- Sent when the bot joins a guild.
- GuildDeleteEvent
- Sent when you leave a guild.
- GuildEmoji
- GuildEmojiPartial
- GuildEmojisUpdateEvent
- Fired when emojis are updated
- GuildFeature
- Guild features
- GuildMemberAddEvent
- Sent when a member joins a guild.
- GuildMemberRemoveEvent
- Sent when a user leaves a guild, can be a leave, kick, or ban.
- GuildMemberUpdateEvent
- Sent when a member is updated.
- GuildMessage
- Message that is sent in guild channel
- GuildNsfwLevel
- GuildPreview
- Returns guild even if the user is not in the guild. This endpoint is only for Public guilds.
- GuildSticker
- Sticker that is available through guild and nitro users that joined that guild have access to them.
- GuildStickerUpdate
- Sent when a guild's stickers have been updated.
- GuildUpdateEvent
- Sent when a guild is updated.
- HttpErrorEvent
- Sent when a failed HTTP response is received.
- HttpResponseEvent
- Sent when a successful HTTP response is received.
- HttpResponseSuccess
- Returned when http request is successfully executed.
- IChannel
- A channel. Abstract base class that defines the base methods and/or properties for all Discord channel types. Generic interface for all channels
- IEmoji
- Represents emoji. Subclasses provides abstraction to custom emojis(like GuildEmoji).
-
IEnum<
T> - Abstract interface for enums in library
- IGuildEmoji
- IHttpEndpoints
- Raw access to all http endpoints exposed by nyxx. Allows to execute specific action without any context.
- IMessageAuthor
- Could be either User, Member or Webhook. Webhook will have most of field missing.
- IMessageButton
- Button component for Message
- IMessageComponent
- Generic container for components that can be attached to message
- Invite
- Represents invite to guild.
- InviteCreatedEvent
- Emitted when invite is creating
- InviteDeletedEvent
- Emitted when invite is deleted
- InviteWithMeta
- Invite object with additional metadata
- INyxx
- Generic interface for Nyxx. Represents basic functionality of Nyxx that are always available.
- ISend
- Marks entity to which message can be sent
- ISticker
- Base interface for all sticker types
- LinkMessageButton
- Button with a link that user will be redirected after clicking
- Member
- MemberCachePolicy
- Cache policies for caching members
- MemberChunkEvent
-
Sent in response to
GUILD_REQUENT_MEMBERS
websocket command. You can use thechunk_index
andchunk_count
to calculate how many chunks are left for your request. - Mentionable
- Provides abstraction for entities which can be mentioned
- Message
- MessageBuilder
- Allows to create pre built custom messages which can be passed to classes which inherits from ISend.
- MessageButton
- Represents button that has attached metadata and will generate interaction event
- MessageCache
- Cache for messages. Provides few utilities methods to facilitate interaction with messages. []= operator throws - use put() instead.
- MessageCachePolicy
- MessageComponentEmoji
- Spacial emoji object for IMessageComponent
- MessageDecoration
- Specifies formatting of String appended with MessageBuilder
- MessageDeleteBulkEvent
- Emitted when multiple messages are deleted at once.
- MessageDeleteEvent
- Sent when a message is deleted.
- MessageFlags
- Extra features of the message
- MessageMultiselect
- MessageMultiselectOption
- MessageReactionAddedEvent
- Emitted when reaction is add to message
- MessageReactionEvent
- Emitted when reaction is added or removed from message
- MessageReactionRemovedEvent
- Emitted when reaction is removed from message
- MessageReactionRemoveEmojiEvent
- Emitted when reactions of certain emoji are deleted
- MessageReactionsRemovedEvent
- Emitted when all reaction are removed
- MessageReceivedEvent
- Sent when a new message is received.
- MessageReference
- Reference data to cross posted message
- MessageTimeStamp
- MessageType
- Represents messgae type
- MessageUpdateEvent
- Sent when a message is updated.
- MinimalGuildChannel
- MinimalTextChannel
- MultipartRequest
- Request with which files will be sent. Cannot contain request body.
- NitroType
- Premium types denote the level of premium a user has.
- Nyxx
- The main place to start with interacting with the Discord API and creating discord bot. From there you can subscribe to various Streams to listen to Events and fetch data from API with provided methods or get cached data.
- NyxxRest
- Lightweight client which do not start ws connections.
- OAuth2Application
- An OAuth2 application.
- OAuth2Guild
- A mini guild object with permissions for OAuth2Info.
- OAuth2Info
- Info about a OAuth2 app, bot, user, and possible guilds that that bot can be invited to.
- OPCodes
- Gateway constants
- PartialSticker
- Partial sticker for message object
- PermissionOverrideBuilder
- Builder for manipulating PermissionsOverrides. Created from existing override or manually by passing type and id of enttiy.
- Permissions
- Permissions for a role or channel override.
- PermissionsBuilder
- Builder for permissions.
- PermissionsConstants
- Permissions constants
- PermissionsOverrides
- Holds permissions overrides for channel
- PermissionsUtils
- Util function for manipulating permissions
- PremiumTier
- Boost level of guild
- PresenceBuilder
- Allows to build object of user presence used later when setting user presence.
- PresenceUpdateEvent
- Sent when a member's presence updates.
- RatelimitEvent
- Sent when the client is rate limit ed, either by the rate limit handler itself, or when a 429 is received.
- RawEvent
- Raw gateway event RawEvent is dispatched ONLY for payload that doesn't match any event built in into Nyxx.
- Reaction
- Reaction object. emoji field can be partial GuildEmoji.
- ReadyEvent
- Sent when the client is ready.
- ReferencedMessage
- Message wrapper that other message replies to. message field can be null of two reasons: backend error or message was deleted. In first case isBackendFetchError will be true and isDeleted in second case.
- ReplyBuilder
- Builder for replying to message
- Role
- RoleBuilder
- Creates role
- RoleCreateEvent
- Sent when a role is created.
- RoleDeleteEvent
- Sent when a role is deleted.
- RoleTags
- Additional Role role tags which hold optional data about role
- RoleUpdateEvent
- Sent when a role is updated.
- Shard
- Shard is single connection to discord gateway. Since bots can grow big, handling thousand of guild on same websocket connections would be very hand. Traffic can be split into different connections which can be run on different processes or even different machines.
- ShardManager
- Spawns, connects, monitors, manages and terminates shards. Sharding will be automatic if no user settings are supplied in ClientOptions when instantiating Nyxx client instance.
- Snowflake
- Snowflake represents id system used by Discord. id property is actual id of entity which holds Snowflake.
- SnowflakeEntity
- Marks a snowflake entity. Snowflake entities are ones that have an id that uniquely identifies them. Includes only actual id of entity and createdAt which is timestamp when entity was created.
- StageChannelInstance
- A StageChannelInstance holds information about a live stage.
- StageChannelInstancePrivacyLevel
- The privacy level of the Stage instance
- StageInstanceEvent
- Event for actions related to stage channels
- StageVoiceGuildChannel
- StandardSticker
- Animated (or not) image like emoji
- StickerBuilder
- Create a new sticker for the guild
- StickerFormat
- Enumerates different possible format of sticker
- StickerPack
- Represents a pack of standard stickers.
- StickerType
- Enumerates different possible format of sticker
- TextChannel
- Generic interface for all text channels types
- TextGuildChannel
- ThreadArchiveTime
- Simplifies the process of setting an auto archive time.
- ThreadBuilder
- ThreadChannel
- ThreadCreateEvent
- Fired when a thread is created
- ThreadDeletedEvent
- Fired when a thread is created
- ThreadListResultWrapper
- Wrapper of threads listing results.
- ThreadMember
- Member of ThreadChannel
- ThreadMembersUpdateEvent
- Fired when a thread has a member added/removed
- ThreadPreviewChannel
- Given when a thread is created as only partial information is available. If you want the final channel use getThreadChannel
- TimeStampStyle
- Style of inline timestamp that can be embedded into message
- TypingEvent
- Sent when a user starts typing.
- UnicodeEmoji
- Represents unicode emoji. Contains only emoji code.
- User
- Represents a single user of Discord, either a human or a bot, outside of any specific guild's context.
- UserFlags
- Additional flags associated with user account. Describes if user has certain features like joined into one of houses or is discord employee.
- UserStatus
- Provides values for user status.
- UserUpdateEvent
- Emitted when user was updated
- Utils
- Collection of misc util functions
- VoiceActivityType
- Activity Types
- VoiceGuildChannel
- VoiceRegion
- Represents voice region on which discord guild takes place
- VoiceServerUpdateEvent
- Emitted when guild's voice server changes
- VoiceState
- Used to represent a user"s voice connection status. If channel is null, it means that user left channel.
- VoiceStateUpdateEvent
- Emitted when client connects/disconnects/mutes etc to voice channel
- Webhook
- Webhooks are a low-effort way to post messages to channels in Discord. They do not require a bot user or authentication to use.
- WebhookType
- Type of webhook. Either incoming if it its normal webhook executable with token, or channelFollower if its discord internal webhook
Extensions
- IntExtensions on int
- Extension on int
-
SnowflakeEntityListExtensions
on Iterable<
SnowflakeEntity> - Extensions on Iterable of Snowflakes entities
- StringExtensions on String
- Extension on int
Typedefs
-
CachePolicyPredicate<
T extends SnowflakeEntity> = bool Function(T) - Predicate which will decide if entity could be cached
-
RawApiMap
= Map<
String, dynamic> -
ShutdownHook
= Future<
void> Function(Nyxx client) - Hook executed when disposing bots process.
-
ShutdownShardHook
= Future<
void> Function(Nyxx client, Shard shard) - Hook executed when shard is disposing.
Exceptions / Errors
- EmbedBuilderArgumentException
- Thrown when embed doesnt meet requirements to be valid
- HttpClientException
- Exception of http client
- HttpResponseError
- Returned when client fails to execute http request. Will contain reason why request failed.
- InvalidShardException
- Thrown when operation is unsupported due invalid or wrong shard being accessed.
- InvalidSnowflakeException
- Thrown when cannot convert provided data to Snowflake
- MissingTokenError
- Thrown when token is empty or null