Nyxx class Null safety

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.
read / write, inherited
channels ChannelCache
All of the channels the bot can see.
late, final, inherited
guilds Cache<Snowflake, Guild>
All of the guilds the bot is in. Can be empty or can miss guilds on (READY_EVENT).
late, final, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
httpEndpoints IHttpEndpoints
Returns handler for all available REST API action.
read-only, inherited
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.
final, inherited
Gets an bot invite link with zero permissions
read-only, inherited
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
onGuildStickersUpdate Stream<GuildStickerUpdate>
Emitted when stage channel instance is deleted
read / write
onGuildUpdate Stream<GuildUpdateEvent>
Emitted when a guild is updated.
read / write
onHttpError Stream<HttpErrorEvent>
Emitted when a HTTP request failed.
read / write, inherited
onHttpResponse Stream<HttpResponseEvent>
Emitted when a successful HTTP response is received.
read / write, inherited
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 rate limited, either by the rate limit handler itself, or when a 429 is received.
read / write, inherited
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
onStageInstanceCreate Stream<StageInstanceEvent>
Emitted when stage channel instance is created
read / write
onStageInstanceDelete Stream<StageInstanceEvent>
Emitted when stage channel instance is deleted
read / write
onStageInstanceUpdate Stream<StageInstanceEvent>
Emitted when stage channel instance is updated
read / write
onThreadCreated Stream<ThreadCreateEvent>
Emitted when a thread is created
read / write
onThreadDelete Stream<ThreadDeletedEvent>
Fired when a thread gets deleted
read / write
onThreadMembersUpdate Stream<ThreadMembersUpdateEvent>
Fired when a thread has a member added/removed
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
options ClientOptions
Can be used to edit options after client initialised. Used by Nyxx.interactions to enable raw events
read-only, inherited
ready bool
True if client is ready.
read / write, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
self ClientUser
The current bot user.
read / write, inherited
shardManager ShardManager
Current client"s shard
read / write
shards int
Returns number of shards
read-only
startTime DateTime
DateTime when client was started
read-only
uptime Duration
The client's uptime.
read-only
users Cache<Snowflake, User>
All of the users the bot can see. Does not have offline users without forceFetchUsers enabled.
late, final, inherited
version String
The current version of nyxx
final, inherited

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 non-existent 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