Skip to content

Commit

Permalink
Merge branch 'dev' into feat/static-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexedia authored Apr 25, 2024
2 parents 72349f3 + d560a92 commit 4065242
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
19 changes: 19 additions & 0 deletions lib/src/extensions/managers/message_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,23 @@ extension MessageManagerExtensions on MessageManager {
pageSize: pageSize,
order: order,
);

/// Same as [fetchReactions], but has no limit on the number of reactions returned.
///
/// {@macro paginated_endpoint_streaming_parameters}
Stream<User> streamReactions(
Snowflake id,
ReactionBuilder emoji, {
Snowflake? after,
Snowflake? before,
int? pageSize,
}) =>
streamPaginatedEndpoint(
({before, after, limit}) => fetchReactions(id, emoji, after: after, limit: limit),
extractId: (user) => user.id,
before: before,
after: after,
pageSize: pageSize,
order: StreamOrder.oldestFirst,
);
}
6 changes: 6 additions & 0 deletions lib/src/extensions/managers/role_manager.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:nyxx/nyxx.dart';

extension RoleManagerExtensions on RoleManager {
/// The role representing `@everyone` in this guild.
PartialRole get everyone => this[guildId];
}
13 changes: 12 additions & 1 deletion lib/src/extensions/message.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:nyxx/nyxx.dart';
import 'package:nyxx_extensions/src/extensions/channel.dart';
import 'package:nyxx_extensions/nyxx_extensions.dart';

/// Extensions on [Message]s.
extension MessageExtensions on Message {
Expand All @@ -25,4 +25,15 @@ extension MessageExtensions on Message {

return channel.sendMessage(copiedBuilder);
}

/// Same as [fetchReactions], but has no limit on the number of reactions returned.
///
/// {@macro paginated_endpoint_streaming_parameters}
Stream<User> streamReactions(
ReactionBuilder emoji, {
Snowflake? after,
Snowflake? before,
int? pageSize,
}) =>
manager.streamReactions(id, emoji, after: after, before: before, pageSize: pageSize);
}
2 changes: 1 addition & 1 deletion lib/src/utils/formatters.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:nyxx/src/models/snowflake.dart';
import 'package:nyxx/nyxx.dart';

/// Wraps the [code] in a code block with the specified language, if any.
String codeBlock(String code, [String language = '']) => '```$language\n$code\n```';
Expand Down

0 comments on commit 4065242

Please sign in to comment.