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:

Nyxx("<TOKEN>");

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.

Inheritance

Constructors

Nyxx(String token, int intents, {ClientOptions? options, CacheOptions? cacheOptions, bool ignoreExceptions = true, bool useDefaultLogger = true})
Creates and logs in a new client. If ignoreExceptions is true (by default is) isolate will ignore all exceptions and continue to work.

Properties

app ClientOAuth2Application
The bot"s OAuth2 app.
getter/setter pairinherited
channels ChannelCache
All of the channels the bot can see.
latefinalinherited
guilds Cache<Snowflake, Guild>
All of the guilds the bot is in. Can be empty or can miss guilds on (READY_EVENT).
latefinalinherited
hashCode int
The hash code for this object.
no setterinherited
httpEndpoints IHttpEndpoints
Returns handler for all available REST API action.
no setterinherited
intents int
When identifying to the gateway, you have to 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. Since api v8 its required upon connecting to gateway.
finalinherited
Gets an bot invite link with zero permissions
no setterinherited
onChannelCreate Stream<ChannelCreateEvent>
Emitted when a channel is created.
getter/setter pair
onChannelDelete Stream<ChannelDeleteEvent>
Emitted when a channel is deleted.
getter/setter pair
onChannelPinsUpdate Stream<ChannelPinsUpdateEvent>
Emitted when channel"s pins are updated.
getter/setter pair
onChannelUpdate Stream<ChannelUpdateEvent>
Emitted when a channel is updated.
getter/setter pair
onDisconnect Stream<DisconnectEvent>
Emitted when a shard is disconnected from the websocket.
getter/setter pair
onDmReceived Stream<MessageReceivedEvent>
Emitted when private message is received.
getter/setter pair
onGuildBanAdd Stream<GuildBanAddEvent>
Emitted when a member is banned.
getter/setter pair
onGuildBanRemove Stream<GuildBanRemoveEvent>
Emitted when a user is unbanned.
getter/setter pair
onGuildCreate Stream<GuildCreateEvent>
Emitted when the client joins a guild.
getter/setter pair
onGuildDelete Stream<GuildDeleteEvent>
Emitted when the client leaves a guild.
getter/setter pair
onGuildEmojisUpdate Stream<GuildEmojisUpdateEvent>
Emitted when guild"s emojis are changed.
getter/setter pair
onGuildMemberAdd Stream<GuildMemberAddEvent>
Emitted when a member joins a guild.
getter/setter pair
onGuildMemberRemove Stream<GuildMemberRemoveEvent>
Emitted when a user leaves a guild.
getter/setter pair
onGuildMemberUpdate Stream<GuildMemberUpdateEvent>
Emitted when a member is updated.
getter/setter pair
onGuildStickersUpdate Stream<GuildStickerUpdate>
Emitted when stage channel instance is deleted
getter/setter pair
onGuildUpdate Stream<GuildUpdateEvent>
Emitted when a guild is updated.
getter/setter pair
onHttpError Stream<HttpErrorEvent>
Emitted when a HTTP request failed.
getter/setter pairinherited
onHttpResponse Stream<HttpResponseEvent>
Emitted when a successful HTTP response is received.
getter/setter pairinherited
onInviteCreated Stream<InviteCreatedEvent>
Emitted when invite is created
getter/setter pair
onInviteDeleted Stream<InviteDeletedEvent>
Emitted when invite is deleted
getter/setter pair
onMessageDelete Stream<MessageDeleteEvent>
Emitted when a message is deleted.
getter/setter pair
onMessageDeleteBulk Stream<MessageDeleteBulkEvent>
Emitted when many messages are deleted at once
getter/setter pair
onMessageReactionAdded Stream<MessageReactionEvent>
Emitted when a user adds a reaction to a message.
getter/setter pair
onMessageReactionRemove Stream<MessageReactionEvent>
Emitted when a user deletes a reaction to a message.
getter/setter pair
onMessageReactionRemoveEmoji Stream<MessageReactionRemoveEmojiEvent>
Emitted when a bot removes all instances of a given emoji from the reactions of a message
getter/setter pair
onMessageReactionsRemoved Stream<MessageReactionsRemovedEvent>
Emitted when a user explicitly removes all reactions from a message.
getter/setter pair
onMessageReceived Stream<MessageReceivedEvent>
Emitted when a message is received. It includes private messages.
getter/setter pair
onMessageUpdate Stream<MessageUpdateEvent>
Emitted when a message is edited. Old message can be null if isn"t cached.
getter/setter pair
onPresenceUpdate Stream<PresenceUpdateEvent>
Emitted when a member"s presence is changed.
getter/setter pair
onRateLimited Stream<RatelimitEvent>
Sent when the client is rate limited, either by the rate limit handler itself, or when a 429 is received.
getter/setter pairinherited
onReady Stream<ReadyEvent>
Emitted when the client is ready. Should be sent only once.
getter/setter pair
onRoleCreate Stream<RoleCreateEvent>
Emitted when a role is created.
getter/setter pair
onRoleDelete Stream<RoleDeleteEvent>
Emitted when a role is deleted.
getter/setter pair
onRoleUpdate Stream<RoleUpdateEvent>
Emitted when a role is updated.
getter/setter pair
onSelfMention Stream<MessageReceivedEvent>
Emitted when bot is mentioned
getter/setter pair
onStageInstanceCreate Stream<StageInstanceEvent>
Emitted when stage channel instance is created
getter/setter pair
onStageInstanceDelete Stream<StageInstanceEvent>
Emitted when stage channel instance is deleted
getter/setter pair
onStageInstanceUpdate Stream<StageInstanceEvent>
Emitted when stage channel instance is updated
getter/setter pair
onThreadCreated Stream<ThreadCreateEvent>
Emitted when a thread is created
getter/setter pair
onThreadDelete Stream<ThreadDeletedEvent>
Fired when a thread gets deleted
getter/setter pair
onThreadMembersUpdate Stream<ThreadMembersUpdateEvent>
Fired when a thread has a member added/removed
getter/setter pair
onTyping Stream<TypingEvent>
Emitted when a user starts typing.
getter/setter pair
onUserUpdate Stream<UserUpdateEvent>
Emitted when user was updated
getter/setter pair
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.
getter/setter pair
onVoiceStateUpdate Stream<VoiceStateUpdateEvent>
Emitted when someone joins/leaves/moves voice channel.
getter/setter pair
options ClientOptions
Can be used to edit options after client initialised. Used by Nyxx.interactions to enable raw events
no setterinherited
ready bool
True if client is ready.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
self ClientUser
The current bot user.
getter/setter pairinherited
shardManager ShardManager
Current client"s shard
getter/setter pair
shards int
Returns number of shards
no setter
startTime DateTime
DateTime when client was started
no setter
uptime Duration
The client's uptime.
no setter
users Cache<Snowflake, User>
All of the users the bot can see. Does not have offline users without forceFetchUsers enabled.
latefinalinherited
version String
The current version of nyxx
finalinherited

Methods

dispose() Future<void>
Perform cleanup
override
fetchChannel<T extends IChannel>(Snowflake channelId) Future<T>
Returns channel with specified id.
fetchGuild(Snowflake guildId) Future<Guild>
Returns guild with given guildId
fetchGuildPreview(Snowflake guildId) Future<GuildPreview>
This endpoint is only for public guilds if bot is not int the guild.
fetchUser(Snowflake userId) Future<User>
Get user instance with specified id.
fetchWebhook(Snowflake id, {String token = ""}) Future<Webhook>
Gets a webhook by its id and/or token. If token is supplied authentication is not needed.
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.
getSticker(Snowflake id) Future<StandardSticker>
Gets standard sticker with given id
joinThread(Snowflake channelId) Future<void>
Join ThreadChannel with given channelId
listNitroStickerPacks() Stream<StickerPack>
List all nitro stickers packs
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setPresence(PresenceBuilder presenceBuilder) → void
Sets presence for bot.
toString() String
A string representation of this object.
inherited

Operators

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