toJson property

  1. @override
Object get toJson

Implementation

@override
Object get toJson {
  final List<Permission> _permissions = permissions ?? [];
  return {
    'name': _label.toLowerCase(),
    'description': _description,
    'type': _type,
    'options': _subcommands.isNotEmpty || _group.isNotEmpty
      ? [
        ..._group.map((group) => group.toJson).toList(),
        ..._subcommands.map((command) => command.toJson).toList()
      ]
      : _options.isNotEmpty
        ? [..._options.map((option) => option.toJson)]
        : [],
    'default_member_permissions': !everyone
      ? _permissions.isNotEmpty
        ? Helper.toBitfield(_permissions.map((e) => e.value).toList()).toString()
        : null
      : 0,
  };
}