build method

  1. @override
RawApiMap build()
override

Returns built response for api

Implementation

@override
RawApiMap build() {
  final map = <String, dynamic>{
    "parse": [
      if (_allowEveryone) "everyone",
      if (_allowRoles) "roles",
      if (_allowUsers) "users",
    ],
    "replied_user": this._allowReply
  };

  if (_users.isNotEmpty) {
    if (!_allowUsers) {
      throw ArgumentError(
          "Invalid configuration of allowed mentions! Allowed `user` and blacklisted users at the same time!");
    }

    map["users"] = _users.map((e) => e.id.toString());
  }

  if (_roles.isNotEmpty) {
    if (!_allowRoles) {
      throw ArgumentError(
          "Invalid configuration of allowed mentions! Allowed `roles` and blacklisted roles at the same time!");
    }

    map["roles"] = _roles.map((e) => e.id.toString());
  }

  return map;
}