Skip to content

Commit

Permalink
feat(api): add command types
Browse files Browse the repository at this point in the history
  • Loading branch information
LeadcodeDev committed Jun 24, 2024
1 parent 6eaa2db commit 55a3833
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/api/common/commands/builder/command_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'package:mineral/api/common/commands/builder/command_group_builder.dart';
import 'package:mineral/api/common/commands/builder/sub_command_builder.dart';
import 'package:mineral/api/common/commands/command_option.dart';
import 'package:mineral/api/common/commands/command_type.dart';

final class CommandBuilder {
String? _name;
Expand Down Expand Up @@ -56,6 +57,7 @@ final class CommandBuilder {
return {
'name': _name,
'description': _description,
if (_subCommands.isEmpty && _groups.isEmpty) 'type': CommandType.subCommand.value,
'options': options,
};
}
Expand Down
2 changes: 2 additions & 0 deletions lib/api/common/commands/builder/command_group_builder.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:mineral/api/common/commands/builder/sub_command_builder.dart';
import 'package:mineral/api/common/commands/command_type.dart';

final class CommandGroupBuilder {
String? _name;
Expand Down Expand Up @@ -26,6 +27,7 @@ final class CommandGroupBuilder {
return {
'name': _name,
'description': _description,
'type': CommandType.subCommandGroup.value,
'options': _commands.map((e) => e.toJson()).toList(),
};
}
Expand Down
2 changes: 2 additions & 0 deletions lib/api/common/commands/builder/sub_command_builder.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:mineral/api/common/commands/command_option.dart';
import 'package:mineral/api/common/commands/command_type.dart';

final class SubCommandBuilder {
String? _name;
Expand Down Expand Up @@ -32,6 +33,7 @@ final class SubCommandBuilder {
return {
'name': _name,
'description': _description,
'type': CommandType.subCommand.value,
'options': _options.map((e) => e.toJson()).toList(),
};
}
Expand Down
2 changes: 2 additions & 0 deletions lib/api/common/types/channel_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ enum ChannelType implements EnhancedEnum<int>{
guildForum(15),
guildMedia(16);

@override
final int value;

const ChannelType(this.value);
}

0 comments on commit 55a3833

Please sign in to comment.