]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/Spamfilter.php
11 public Connection
$connection;
13 public function __construct(Connection
$conn)
15 $this->connection
= $conn;
21 * @return stdClass|array|bool
24 public function add(string $name, string $match_type, string $spamfilter_targets, string $ban_action, string $ban_duration, string $reason): stdClass
|array|bool
26 return $this->connection
->query('spamfilter.add', [
28 'match_type' => $match_type,
29 'spamfilter_targets' => $spamfilter_targets,
30 'ban_action' => $ban_action,
31 'ban_duration' => $ban_duration,
37 * Delete a spamfilter.
39 * @return stdClass|array|bool
42 public function delete(string $name, string $match_type, string $spamfilter_targets, string $ban_action): stdClass
|array|bool
44 return $this->connection
->query('spamfilter.del', [
46 'match_type' => $match_type,
47 'spamfilter_targets' => $spamfilter_targets,
48 'ban_action' => $ban_action,
53 * Return a list of all spamfilters.
55 * @return stdClass|array|bool
58 public function getAll(): stdClass
|array|bool
60 $response = $this->connection
->query('spamfilter.list');
62 if (!is_bool($response)) {
63 return $response->list;
66 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
70 * Get a specific spamfilter.
72 * @return stdClass|array|bool
75 public function get(string $name, string $match_type, string $spamfilter_targets, string $ban_action): stdClass
|array|bool
77 $response = $this->connection
->query('spamfilter.get', [
79 'match_type' => $match_type,
80 'spamfilter_targets' => $spamfilter_targets,
81 'ban_action' => $ban_action,
84 if (!is_bool($response)) {
88 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');