Skip to content

Commit

Permalink
Merge pull request #115 from nyxx-discord/dev
Browse files Browse the repository at this point in the history
Release 4.4.0
  • Loading branch information
l7ssha authored Mar 4, 2023
2 parents 1ae5e24 + 0c07dcb commit 7e76431
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.4.0
__Miscellaneous__:
- Bump `analyzer` to 5.7.1, `args` to 2.4.0, `dart_style` to 2.2.5, `logging` to 1.1.1, `meta` to 1.9.0, `nyxx` to 4.5.0, `nyxx_interactions` to 4.5.0, `path` to 1.8.3 `build_runner` to 2.1.0, `coverage` to 1.6.3, `lints` to 2.0.1, `mockito` to 5.3.2, and `test` to 1.23.1.

## 4.3.0
__New features__:
- Added support for command localization. See `localizedNames` on all `ICommand`s and `localizedDescriptions` for `ChatCommand`s and the `@Description()` annotation.
Expand Down
2 changes: 1 addition & 1 deletion bin/compile/element_tree_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ class EntireAstVisitor extends RecursiveAstVisitor<void> {
super.visitPartDirective(directive);

// Visit "part-ed" files of interesting sources
_interestingSources.add(directive.uriSource!.fullName);
_interestingSources.add(directive.uri.stringValue!);
}
}
4 changes: 2 additions & 2 deletions bin/compile/function_metadata/metadata_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Iterable<CompileTimeFunctionData> getFunctionData(
];

for (final parameter in parameterList.parameters.skip(1)) {
if (parameter.identifier == null) {
if (parameter.name == null) {
// Parameters must have a name to be used. Skip this function.
continue outerLoop;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ Iterable<CompileTimeFunctionData> getFunctionData(
localizedNames = nameArgs?.last;
}
} else {
name = parameter.identifier!.name;
name = parameter.name!.lexeme;
}

if (descriptionAnnotations.isNotEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion bin/compile/to_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ List<String>? toTypeSource(DartType type, [bool handleTypeParameters = true]) {
}

String? importPrefix;
if (type.element is ClassElement) {
if (type.element is InterfaceElement) {
importPrefix = toImportPrefix(type.element!.library!.source.uri.toString());
}

Expand Down
44 changes: 22 additions & 22 deletions bin/compile/type_tree/tree_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,45 +83,45 @@ int getId(DartType type) {
// We keep track of the IDs of special types

/// The ID of the [Name] class type.
int get nameId => getId(nameClassElement!.thisType);
ClassElement? nameClassElement;
int get nameId => getId(nameInterfaceElement!.thisType);
InterfaceElement? nameInterfaceElement;

/// The ID of the [Description] class type.
int get descriptionId => getId(descriptionClassElement!.thisType);
ClassElement? descriptionClassElement;
int get descriptionId => getId(descriptionInterfaceElement!.thisType);
InterfaceElement? descriptionInterfaceElement;

/// The ID of the [Choices] class type.
int get choicesId => getId(choicesClassElement!.thisType);
ClassElement? choicesClassElement;
int get choicesId => getId(choicesInterfaceElement!.thisType);
InterfaceElement? choicesInterfaceElement;

/// The ID of the [UseConverter] class type.
int get useConverterId => getId(useConverterClassElement!.thisType);
ClassElement? useConverterClassElement;
int get useConverterId => getId(useConverterInterfaceElement!.thisType);
InterfaceElement? useConverterInterfaceElement;

/// The ID of the [Autocomplete] class type.
int get autocompleteId => getId(autocompleteClassElement!.thisType);
ClassElement? autocompleteClassElement;
int get autocompleteId => getId(autocompleteInterfaceElement!.thisType);
InterfaceElement? autocompleteInterfaceElement;

/// The ID of the [Object] class type.
int get objectId => getId(objectClassElement!.thisType);
ClassElement? objectClassElement;
int get objectId => getId(objectInterfaceElement!.thisType);
InterfaceElement? objectInterfaceElement;

/// The ID of the [Function] class type,
int get functionId => getId(functionClassElement!.thisType);
ClassElement? functionClassElement;
int get functionId => getId(functionInterfaceElement!.thisType);
InterfaceElement? functionInterfaceElement;

Map<List<String>, void Function(ClassElement)> _specialInterfaceTypeSetters = {
Map<List<String>, void Function(InterfaceElement)> _specialInterfaceTypeSetters = {
['package:nyxx_commands/src/util/util.dart', 'Description']: (element) =>
descriptionClassElement = element,
['package:nyxx_commands/src/util/util.dart', 'Name']: (element) => nameClassElement = element,
descriptionInterfaceElement = element,
['package:nyxx_commands/src/util/util.dart', 'Name']: (element) => nameInterfaceElement = element,
['package:nyxx_commands/src/util/util.dart', 'Choices']: (element) =>
choicesClassElement = element,
choicesInterfaceElement = element,
['package:nyxx_commands/src/util/util.dart', 'UseConverter']: (element) =>
useConverterClassElement = element,
useConverterInterfaceElement = element,
['package:nyxx_commands/src/util/util.dart', 'Autocomplete']: (element) =>
autocompleteClassElement = element,
['dart:core/object.dart', 'Object']: (element) => objectClassElement = element,
['dart:core/function.dart', 'Function']: (element) => functionClassElement = element,
autocompleteInterfaceElement = element,
['dart:core/object.dart', 'Object']: (element) => objectInterfaceElement = element,
['dart:core/function.dart', 'Function']: (element) => functionInterfaceElement = element,
};

/// Update the special types if needed.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/commands/chat_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ mixin ChatGroupMixin implements IChatCommandComponent {
String get fullName =>
(parent == null || parent is! ICommandRegisterable
? ''
: (parent as ICommandRegisterable).name + ' ') +
: '${(parent as ICommandRegisterable).name} ') +
name;

@override
Expand Down
28 changes: 14 additions & 14 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nyxx_commands
version: 4.3.0
version: 4.4.0
description: A framework for easily creating slash commands and text commands for Discord using the nyxx library.

homepage: https://github.com/nyxx-discord/nyxx_commands/blob/main/README.md
Expand All @@ -10,22 +10,22 @@ environment:
sdk: '>=2.17.0 <3.0.0'

dependencies:
analyzer: ^3.4.1
args: ^2.3.0
dart_style: ^2.2.1
logging: ^1.0.2
meta: ^1.7.0
nyxx: ^4.0.0
nyxx_interactions: ^4.3.1
analyzer: ^5.7.1
args: ^2.4.0
dart_style: ^2.2.5
logging: ^1.1.1
meta: ^1.9.0
nyxx: ^4.5.0
nyxx_interactions: ^4.5.0
random_string: ^2.3.1
path: ^1.8.1
path: ^1.8.3

dev_dependencies:
build_runner: ^2.1.4
coverage: ^1.0.3
lints: ^1.0.1
mockito: ^5.0.16
test: ^1.19.0
build_runner: ^2.1.0
coverage: ^1.6.3
lints: ^2.0.1
mockito: ^5.3.2
test: ^1.23.1

executables:
nyxx-compile: compile

0 comments on commit 7e76431

Please sign in to comment.