Merge branch 'rewrite_modular' into rewrite_modular_nocache
This commit is contained in:
commit
7d66fae22c
23
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
23
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
|
||||
|
||||
Use smart commits here to manipulate issues (eg. Fixes #issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
|
||||
# Checklist:
|
||||
|
||||
- [ ] Ran `dartfmt -w -l 120 --fix .`
|
||||
- [ ] Ran `dartanalyzer --options analysis_options.yaml .`
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
|
|
@ -118,7 +118,7 @@ abstract class CachelessGuildChannel extends IGuildChannel {
|
|||
}
|
||||
|
||||
final permSet = perms._build();
|
||||
|
||||
|
||||
await client._http._execute(BasicRequest._new("/channels/${this.id}/permissions/${entity.id.toString()}",
|
||||
method: "PUT", body: {
|
||||
"type" : entity is IRole ? "role" : "member",
|
||||
|
|
|
@ -67,7 +67,7 @@ class CachelessMember extends IMember {
|
|||
if (raw["hoisted_role"] != null && roles.isNotEmpty) {
|
||||
// TODO: NNBD: try-catch in where
|
||||
try {
|
||||
this.hoistedRole = this.roles.firstWhere((element) => element.id == IRole._new(Snowflake(raw["hoisted_role"]), this.guildId, client));
|
||||
this.hoistedRole = this.roles.firstWhere((element) => element.id == Snowflake(raw["hoisted_role"]));
|
||||
} on Error {
|
||||
this.hoistedRole = null;
|
||||
}
|
||||
|
|
|
@ -125,10 +125,17 @@ class ActivityTimestamps {
|
|||
|
||||
/// Represents type of presence activity
|
||||
class ActivityType extends IEnum<int> {
|
||||
///Status type when playing a game
|
||||
static const ActivityType game = ActivityType._create(0);
|
||||
|
||||
///Status type when streaming a game. Only supports twitch.tv or youtube.com url
|
||||
static const ActivityType streaming = ActivityType._create(1);
|
||||
|
||||
///Status type when listening to Spotify
|
||||
static const ActivityType listening = ActivityType._create(2);
|
||||
static const ActivityType custom = ActivityType._create(3);
|
||||
|
||||
///Custom status, not supported for bot accounts
|
||||
static const ActivityType custom = ActivityType._create(4);
|
||||
|
||||
/// Creates [ActivityType] from [value]
|
||||
ActivityType.from(int value) : super(value);
|
||||
|
|
|
@ -77,10 +77,10 @@ class User extends SnowflakeEntity with ISend, Mentionable, IMessageAuthor {
|
|||
|
||||
/// Gets the [DMChannel] for the user.
|
||||
Future<DMChannel> get dmChannel async {
|
||||
var channel = client.channels.findOne((Channel c) => c is DMChannel && c.recipient.id == this.id) as DMChannel?;
|
||||
final dChannel = client.channels.findOne((Channel c) => c is DMChannel && c.recipient.id == this.id) as DMChannel?;
|
||||
|
||||
if (channel != null) {
|
||||
return channel;
|
||||
if(dChannel != null) {
|
||||
return dChannel;
|
||||
}
|
||||
|
||||
final response = await this
|
||||
|
@ -89,9 +89,8 @@ class User extends SnowflakeEntity with ISend, Mentionable, IMessageAuthor {
|
|||
._execute(BasicRequest._new("/users/@me/channels", method: "POST", body: {"recipient_id": this.id.toString()}));
|
||||
|
||||
if (response is HttpResponseSuccess) {
|
||||
channel = DMChannel._new(response.jsonBody as Map<String, dynamic>, client);
|
||||
final channel = DMChannel._new(response.jsonBody as Map<String, dynamic>, client);
|
||||
this.client.channels.add(channel.id, channel);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
|
3
nyxx/lib/src/internal/cache/Cache.dart
vendored
3
nyxx/lib/src/internal/cache/Cache.dart
vendored
|
@ -13,10 +13,9 @@ abstract class Cache<T, S> implements Disposable {
|
|||
|
||||
/// Find one element in cache
|
||||
S? findOne(bool Function(S item) predicate) {
|
||||
// TODO: NNBD: try-catch in where
|
||||
try {
|
||||
return values.firstWhere(predicate);
|
||||
} on Exception {
|
||||
} on Error {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue