Nyxx class

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.

Creating new instance of bot:


After initializing nyxx you can subscribe to events:

client.onReady.listen((e) => print("Ready!"));

client.onRoleCreate.listen((e) {
  print("Role created with name: ${e.role.name});

or setup CommandsFramework and Voice.

Implemented types


Nyxx(String _token, {ClientOptions options, bool ignoreExceptions: true, bool useDefaultLogger: true, Level defaultLoggerLogLevel})
Creates and logs in a new client. If ignoreExceptions is true (by default is) isolate will ignore all exceptions and continue to work.


app ClientOAuth2Application
The bot"s OAuth2 app.
read / write
channels ChannelCache
All of the channels the bot can see.
read / write, final, late
guilds Cache<Snowflake, Guild>
All of the guilds the bot is in. Can be empty or can miss guilds on (READY_EVENT).
read / write, final, late
hashCode int
The hash code for this object. [...]
read-only, inherited
Gets an bot invite link with zero permissions
onChannelCreate Stream<ChannelCreateEvent>
Emitted when a channel is created.
read / write
onChannelDelete Stream<ChannelDeleteEvent>
Emitted when a channel is deleted.
read / write
onChannelPinsUpdate Stream<ChannelPinsUpdateEvent>
Emitted when channel"s pins are updated.
read / write
onChannelUpdate Stream<ChannelUpdateEvent>
Emitted when a channel is updated.
read / write
onDisconnect Stream<DisconnectEvent>
Emitted when a shard is disconnected from the websocket.
read / write
onDmReceived Stream<MessageReceivedEvent>
Emitted when private message is received.
read / write
onGuildBanAdd Stream<GuildBanAddEvent>
Emitted when a member is banned.
read / write
onGuildBanRemove Stream<GuildBanRemoveEvent>
Emitted when a user is unbanned.
read / write
onGuildCreate Stream<GuildCreateEvent>
Emitted when the client joins a guild.
read / write
onGuildDelete Stream<GuildDeleteEvent>
Emitted when the client leaves a guild.
read / write
onGuildEmojisUpdate Stream<GuildEmojisUpdateEvent>
Emitted when guild"s emojis are changed.
read / write
onGuildMemberAdd Stream<GuildMemberAddEvent>
Emitted when a member joins a guild.
read / write
onGuildMemberRemove Stream<GuildMemberRemoveEvent>
Emitted when a user leaves a guild.
read / write
onGuildMemberUpdate Stream<GuildMemberUpdateEvent>
Emitted when a member is updated.
read / write
onGuildUpdate Stream<GuildUpdateEvent>
Emitted when a guild is updated.
read / write
onHttpError Stream<HttpErrorEvent>
Emitted when a HTTP request failed.
read / write
onHttpResponse Stream<HttpResponseEvent>
Emitted when a successful HTTP response is received.
read / write
onInviteCreated Stream<InviteCreatedEvent>
Emitted when invite is created
read / write
onInviteDeleted Stream<InviteDeletedEvent>
Emitted when invite is deleted
read / write
onMessageDelete Stream<MessageDeleteEvent>
Emitted when a message is deleted.
read / write
onMessageDeleteBulk Stream<MessageDeleteBulkEvent>
Emitted when many messages are deleted at once
read / write
onMessageReactionAdded Stream<MessageReactionEvent>
Emitted when a user adds a reaction to a message.
read / write
onMessageReactionRemove Stream<MessageReactionEvent>
Emitted when a user deletes a reaction to a message.
read / write
onMessageReactionRemoveEmoji Stream<MessageReactionRemoveEmojiEvent>
Emitted when a bot removes all instances of a given emoji from the reactions of a message
read / write
onMessageReactionsRemoved Stream<MessageReactionsRemovedEvent>
Emitted when a user explicitly removes all reactions from a message.
read / write
onMessageReceived Stream<MessageReceivedEvent>
Emitted when a message is received. It includes private messages.
read / write
onMessageUpdate Stream<MessageUpdateEvent>
Emitted when a message is edited. Old message can be null if isn"t cached.
read / write
onPresenceUpdate Stream<PresenceUpdateEvent>
Emitted when a member"s presence is changed.
read / write
onRatelimited Stream<RatelimitEvent>
Sent when the client is ratelimited, either by the ratelimit handler itself, or when a 429 is received.
read / write
onReady Stream<ReadyEvent>
Emitted when the client is ready. Should be sent only once.
read / write
onRoleCreate Stream<RoleCreateEvent>
Emitted when a role is created.
read / write
onRoleDelete Stream<RoleDeleteEvent>
Emitted when a role is deleted.
read / write
onRoleUpdate Stream<RoleUpdateEvent>
Emitted when a role is updated.
read / write
onSelfMention Stream<MessageReceivedEvent>
Emitted when bot is mentioned
read / write
onTyping Stream<TypingEvent>
Emitted when a user starts typing.
read / write
onUserUpdate Stream<UserUpdateEvent>
Emitted when user was updated
read / write
onVoiceServerUpdate Stream<VoiceServerUpdateEvent>
Emitted when a guild"s voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server.
read / write
onVoiceStateUpdate Stream<VoiceStateUpdateEvent>
Emitted when someone joins/leaves/moves voice channel.
read / write
ready bool
True if client is ready.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
self ClientUser
The current bot user.
read / write
shardManager ShardManager
Current client"s shard
read / write
shards int
Returns number of shards
startTime DateTime
DateTime when client was started
uptime Duration
The client"s uptime.
users Cache<Snowflake, User>
All of the users the bot can see. Does not have offline users without forceFetchUsers enabled.
read / write, final, late
version String
The current version of nyxx


createGuild(GuildBuilder builder) Future<Guild>
Creates new guild with provided builder. Only for bots with less than 10 guilds otherwise it will return Future with error. [...]
dispose() Future<void>
Perform cleanup
getChannel<T extends Channel>(Snowflake id, [bool useCache = true]) Future<T>
Returns channel with specified id. If channel is in cache - will be taken from it otherwise API will be called. [...]
getGuild(Snowflake guildId, [bool useCache = true]) Future<Guild>
Returns guild with given guildId
getGuildPreview(Snowflake guildId) Future<GuildPreview>
Returns guild even if the user is not in the guild. This endpoint is only for Public guilds.
getInvite(String code) Future<Invite>
Gets an Invite object with given code. If the code is in cache - it will be taken from it, otherwise API will be called. [...]
getUser(Snowflake id, [bool useCache = true]) Future<User>
Get user instance with specified id. If id is present in cache it"ll be got from cache, otherwise API will be called. [...]
getWebhook(String id, {String token: ""}) Future<Webhook>
Gets a webhook by its id and/or token. If token is supplied authentication is not needed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
setPresence(PresenceBuilder presenceBuilder) → void
Sets presence for bot. [...]
toString() String
Returns a string representation of this object.


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