Fix onSelfMention event stream; Bump versions

This commit is contained in:
Szymon Uglis 2021-03-26 17:47:32 +01:00 committed by Szymon Uglis
parent 87ea7569fb
commit fb892295fe
No known key found for this signature in database
GPG key ID: 112376C5BEE91FE2
4 changed files with 28 additions and 17 deletions

View file

@ -11,5 +11,5 @@ environment:
dependencies:
http: "^0.13.0"
logging: "^1.0.0"
logging: "^1.0.1"
nyxx: "^1.1.0-dev.5"

View file

@ -10,5 +10,5 @@ environment:
sdk: '>=2.12.0 <2.13.0'
dependencies:
logging: "^1.0.0"
logging: "^1.0.1"
nyxx: "1.1.0-dev.4"

View file

@ -183,17 +183,26 @@ class Nyxx implements Disposable {
/// Gets an bot invite link with zero permissions
String get inviteLink => app.getInviteUrl();
/// Can be used to edit options after client initialised. Used by Nyxx.interactions to enable raw events
ClientOptions get options => this._options;
/// Returns handler for all available REST API action.
IHttpEndpoints get httpEndpoints => this._httpEndpoints;
/// Creates and logs in a new client. If [ignoreExceptions] is true (by default is)
/// isolate will ignore all exceptions and continue to work.
Nyxx(this._token, this.intents, {ClientOptions? options, CacheOptions? cacheOptions, bool ignoreExceptions = true, bool useDefaultLogger = true, Level? defaultLoggerLogLevel}) {
Nyxx(this._token, this.intents,
{ClientOptions? options,
CacheOptions? cacheOptions,
bool ignoreExceptions = true,
bool useDefaultLogger = true,
Level? defaultLoggerLogLevel}) {
if (useDefaultLogger) {
Logger.root.level = defaultLoggerLogLevel ?? Level.ALL;
Logger.root.onRecord.listen((LogRecord rec) {
print("[${rec.time}] [${rec.level.name}] [${rec.loggerName}] ${rec.message}");
print(
"[${rec.time}] [${rec.level.name}] [${rec.loggerName}] ${rec.message}");
});
}
@ -234,8 +243,11 @@ class Nyxx implements Disposable {
this._httpEndpoints = _HttpEndpoints._new(this);
this._events = _EventController(this);
this.onSelfMention = this.onMessageReceived.where((event) => event.message.mentions.contains(this.self));
this.onDmReceived = this.onMessageReceived.where((event) => event.message is DMMessage);
this.onSelfMention = this
.onMessageReceived
.where((event) => event.message.mentions.any((element) => element.id == this.self.id));
this.onDmReceived =
this.onMessageReceived.where((event) => event.message is DMMessage);
this._ws = _ConnectionManager(this);
}
@ -246,7 +258,6 @@ class Nyxx implements Disposable {
/// [DateTime] when client was started
DateTime get startTime => _startTime;
/// Returns guild even if the user is not in the guild.
/// This endpoint is only for Public guilds if bot is not int the guild.
Future<GuildPreview> fetchGuildPreview(Snowflake guildId) async =>
this._httpEndpoints.fetchGuildPreview(guildId);

View file

@ -1,5 +1,5 @@
name: nyxx
version: 1.1.0-dev.4
version: 1.1.0-dev.5
description: A Discord library for Dart.
homepage: https://github.com/l7ssha/nyxx
repository: https://github.com/l7ssha/nyxx
@ -11,7 +11,7 @@ environment:
dependencies:
http: "^0.13.0"
logging: "^1.0.0"
logging: "^1.0.1"
path: "^1.8.0"
dev_dependencies: