Update nyxx.commander to nyxx 1.1.0-dev.5

This commit is contained in:
Szymon Uglis 2021-03-25 22:27:38 +01:00 committed by Szymon Uglis
parent 3f4ceba4b8
commit 955f054cf7
No known key found for this signature in database
GPG key ID: 112376C5BEE91FE2
2 changed files with 4 additions and 4 deletions

View file

@ -20,7 +20,7 @@ class CommandContext {
: null;
/// Reference to client
Nyxx get client => channel.client;
Nyxx get client => channel.client as Nyxx;
/// Shard on which message was sent
int get shardId => this.guild != null ? this.guild!.shard.id : 0;
@ -139,7 +139,7 @@ class CommandContext {
Future<Map<IEmoji, int>> awaitEmojis(Message msg, Duration duration){
final collectedEmoji = <IEmoji, int>{};
return Future<Map<IEmoji, int>>(() async {
await for (final event in msg.client.onMessageReactionAdded.where((evnt) => evnt.message != null && evnt.message!.id == msg.id)) {
await for (final event in (msg.client as Nyxx).onMessageReactionAdded.where((evnt) => evnt.message != null && evnt.message!.id == msg.id)) {
if (collectedEmoji.containsKey(event.emoji)) {
// TODO: NNBD: weird stuff
var value = collectedEmoji[event.emoji];
@ -161,7 +161,7 @@ class CommandContext {
/// Waits for first [TypingEvent] and returns it. If timed out returns null.
/// Can listen to specific user by specifying [user]
Future<TypingEvent?> waitForTyping(User user, {Duration timeout = const Duration(seconds: 30)}) =>
Future<TypingEvent?>(() => user.client.onTyping.firstWhere((e) => e.user == user && e.channel == this.channel)).timeout(timeout, onTimeout: () => null);
Future<TypingEvent?>(() => (user.client as Nyxx).onTyping.firstWhere((e) => e.user == user && e.channel == this.channel)).timeout(timeout, onTimeout: () => null);
/// Gets all context channel messages that satisfies [predicate].
///

View file

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