]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/ServerBan.php
ab8ea2fdbb66fef7f36ef3fb1dc3c103a01b1f50
11 public Connection
$connection;
13 public function __construct(Connection
$conn)
15 $this->connection
= $conn;
22 * @return stdClass|array|bool
25 public function add(string $name, string $type, string $duration, string $reason): stdClass
|array|bool
27 $response = $this->connection
->query('server_ban.add', [
31 'duration_string' => $duration ?? '1d',
33 if (property_exists($response, 'tkl'))
34 return $response->tkl
;
42 * @return stdClass|array|bool
45 public function delete(string $name, string $type): stdClass
|array|bool
47 $response = $this->connection
->query('server_ban.del', [
51 if (property_exists($response, 'tkl'))
52 return $response->tkl
;
57 * Return a list of all bans.
59 * @return stdClass|array|bool
62 public function getAll(): stdClass
|array|bool
64 $response = $this->connection
->query('server_ban.list');
66 if (!is_bool($response)) {
67 return $response->list;
70 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
76 * @return stdClass|array|bool
79 public function get(string $name, string $type): stdClass
|array|bool
81 $response = $this->connection
->query('server_ban.get', [
86 if (!is_bool($response)) {
87 return $response->tkl
;
90 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');