build method

  1. @override
Map<String, Object?> build()
override

Implementation

@override
Map<String, Object?> build() => {
      'name': name,
      if (nameLocalizations != null) 'name_localizations': {for (final MapEntry(:key, :value) in nameLocalizations!.entries) key.identifier: value},
      if (description != null) 'description': description,
      if (descriptionLocalizations != null)
        'description_localizations': {for (final MapEntry(:key, :value) in descriptionLocalizations!.entries) key.identifier: value},
      if (options != null) 'options': options!.map((e) => e.build()).toList(),
      if (defaultMemberPermissions != null) 'default_member_permissions': defaultMemberPermissions!.value.toString(),
      // ignore: deprecated_member_use_from_same_package
      if (hasDmPermission != null) 'dm_permission': hasDmPermission,
      'type': type.value,
      if (isNsfw != null) 'nsfw': isNsfw,
      if (integrationTypes != null) 'integration_types': integrationTypes!.map((type) => type.value).toList(),
      if (contexts != null) 'contexts': contexts!.map((type) => type.value).toList(),
    };