}
/**
+ * Add a ban.
+ *
* @param string $user
- * @param string $type
* @param array $params
* @return stdClass
* @throws Exception
*/
- public function add(string $user, string $type, array $params): stdClass
+ public function add(string $user, array $params): stdClass
{
- $response = $this->connection->query('server_ban.add', [
- 'name' => $params['name'],
+ return $this->connection->query('server_ban.add', [
+ 'name' => $user,
'type' => $params['type'],
'reason' => $params['reason'],
- 'length' => $params['length'] ?? '1d',
+ 'duration_string' => $params['length'] ?? '1d',
]);
-
- if (is_bool($response)) {
- return $response;
- }
-
- throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
/**
+ * Delete a ban.
+ *
* @param string $user
- * @param string $type
* @param array $params
* @return stdClass
* @throws Exception
*/
- public function delete(string $user, string $type, array $params): stdClass
+ public function delete(string $user, array $params): stdClass
{
- $response = $this->connection->query('server_ban.del', [
- 'name' => $params['name'],
+ return $this->connection->query('server_ban.del', [
+ 'name' => $user,
'type' => $params['type'],
]);
-
- if (is_bool($response)) {
- return $response;
- }
-
- throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
}
/**
- * @return array|bool
+ * Return a list of all bans.
+ *
+ * @return stdClass
* @throws Exception
*/
public function get(): stdClass
}
/**
+ * Show a specific ban.
+ *
* @param array $params
- * @return object|bool
+ * @return stdClass
* @throws Exception
*/
public function show(array $params): stdClass