Remove unneeded override; Add docs; Fix naming of few variables; Fix slash commands and deserialization bugs
This commit is contained in:
parent
99f14e1174
commit
60b86190c5
|
@ -1,5 +1,6 @@
|
|||
part of nyxx;
|
||||
|
||||
/// Represents private channel with user
|
||||
class DMChannel extends IChannel implements TextChannel {
|
||||
@override
|
||||
late final MessageCache messageCache = MessageCache._new(client._options.messageCacheSize);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
part of nyxx;
|
||||
|
||||
/// Generic interface for all text channels types
|
||||
abstract class TextChannel implements IChannel, ISend {
|
||||
/// File upload limit for channel in bytes.
|
||||
Future<int> get fileUploadLimit;
|
||||
|
@ -74,14 +75,11 @@ abstract class TextChannel implements IChannel, ISend {
|
|||
Stream<Message> downloadMessages({int limit = 50, Snowflake? after, Snowflake? around, Snowflake? before});
|
||||
|
||||
/// Starts typing.
|
||||
@override
|
||||
Future<void> startTyping();
|
||||
|
||||
/// Loops `startTyping` until `stopTypingLoop` is called.
|
||||
@override
|
||||
void startTypingLoop();
|
||||
|
||||
/// Stops a typing loop if one is running.
|
||||
@override
|
||||
void stopTypingLoop();
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ part of nyxx;
|
|||
/// Extra features of the message
|
||||
class MessageFlags {
|
||||
/// This message has been published to subscribed channels (via Channel Following)
|
||||
late final bool crossposted;
|
||||
late final bool crossPosted;
|
||||
|
||||
/// This message originated from a message in another channel (via Channel Following)
|
||||
late final bool isCrosspost;
|
||||
late final bool isCrossPost;
|
||||
|
||||
/// Do not include any embeds when serializing this message
|
||||
late final bool supressEmbeds;
|
||||
late final bool suppressEmbeds;
|
||||
|
||||
/// The source message for this crosspost has been deleted (via Channel Following)
|
||||
late final bool sourceMessageDeleted;
|
||||
|
@ -18,9 +18,9 @@ class MessageFlags {
|
|||
late final bool urgent;
|
||||
|
||||
MessageFlags._new(int raw) {
|
||||
this.crossposted = PermissionsUtils.isApplied(raw, 1 << 0);
|
||||
this.isCrosspost = PermissionsUtils.isApplied(raw, 1 << 1);
|
||||
this.supressEmbeds = PermissionsUtils.isApplied(raw, 1 << 2);
|
||||
this.crossPosted = PermissionsUtils.isApplied(raw, 1 << 0);
|
||||
this.isCrossPost = PermissionsUtils.isApplied(raw, 1 << 1);
|
||||
this.suppressEmbeds = PermissionsUtils.isApplied(raw, 1 << 2);
|
||||
this.sourceMessageDeleted = PermissionsUtils.isApplied(raw, 1 << 3);
|
||||
this.urgent = PermissionsUtils.isApplied(raw, 1 << 4);
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ abstract class IHttpEndpoints {
|
|||
|
||||
/// Used to send a request including the bot token header.
|
||||
Future<_HttpResponse> sendRawRequest(String url, String method, {dynamic body, dynamic headers});
|
||||
|
||||
|
||||
Future<GuildPreview> fetchGuildPreview(Snowflake guildId);
|
||||
|
||||
Future<IChannel> createGuildChannel(Snowflake guildId, ChannelBuilder channelBuilder);
|
||||
|
@ -794,7 +794,7 @@ class _HttpEndpoints implements IHttpEndpoints {
|
|||
return;
|
||||
}
|
||||
|
||||
for (final raw in (response as HttpResponseSuccess)._jsonBody.values) {
|
||||
for (final raw in (response as HttpResponseSuccess)._jsonBody) {
|
||||
yield Webhook._new(raw as Map<String, dynamic>, _client);
|
||||
}
|
||||
}
|
||||
|
|
2
nyxx/lib/src/internal/cache/Cache.dart
vendored
2
nyxx/lib/src/internal/cache/Cache.dart
vendored
|
@ -66,11 +66,9 @@ class Cache<T, S> implements Disposable {
|
|||
Iterable<S> takeLast(int count) => values.toList().sublist(values.length - count);
|
||||
|
||||
/// Get first element
|
||||
@override
|
||||
S? get first => _cache.values.first;
|
||||
|
||||
/// Get last element
|
||||
@override
|
||||
S get last => _cache.values.last;
|
||||
|
||||
/// Get number of elements from cache
|
||||
|
|
|
@ -28,9 +28,12 @@ String _determineInteractionCommandHandler(Interaction interaction) {
|
|||
// ignore: empty_catches
|
||||
} on Error { }
|
||||
|
||||
final subCommand = interaction.args.firstWhere((element) => element.type == CommandOptionType.subCommand);
|
||||
|
||||
return "$commandHash${subCommand.name}";
|
||||
try {
|
||||
final subCommand = interaction.args.firstWhere((element) => element.type == CommandOptionType.subCommand);
|
||||
return "$commandHash${subCommand.name}";
|
||||
} on Error {
|
||||
return commandHash;
|
||||
}
|
||||
}
|
||||
|
||||
/// Groups [SlashCommandBuilder] for registering them later in bulk
|
||||
|
|
Loading…
Reference in a new issue