-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some short-circuit methods (#46)
- Loading branch information
Showing
11 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'package:nyxx/nyxx.dart'; | ||
|
||
extension GuildDeleteEventExtensions on GuildDeleteEvent { | ||
/// Whether the client was removed from the guild, due to a ban or kick. | ||
bool get wasRemoved => isUnavailable == false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
import 'package:nyxx/nyxx.dart'; | ||
import 'package:nyxx_extensions/src/utils/permissions.dart'; | ||
import 'package:nyxx_extensions/src/extensions/cdn_asset.dart'; | ||
|
||
/// Extensions on [PartialMember]s. | ||
extension PartialMemberExtensions on PartialMember { | ||
/// Compute this member's permissions in [channel]. | ||
/// | ||
/// {@macro compute_permissions_detail} | ||
Future<Permissions> computePermissionsIn(GuildChannel channel) async => await computePermissions(channel, await get()); | ||
|
||
/// Kick this member from the guild. | ||
/// | ||
/// External references: | ||
/// | ||
/// - [MemberManager.delete] | ||
/// - Discord API Reference: https://discord.com/developers/docs/resources/guild#remove-guild-member | ||
Future<void> kick({String? auditLogReason}) => delete(auditLogReason: auditLogReason); | ||
} | ||
|
||
extension MemberExtensions on Member { | ||
/// The URL of this member's avatar decoration. | ||
// Same as in UserExtensions. | ||
Uri? get avatarDecorationUrl => avatarDecoration?.get(format: CdnFormat.png); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// ignore_for_file: implementation_imports | ||
|
||
import 'dart:convert'; | ||
|
||
import 'package:http/http.dart' as http; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters