]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/Channel.php
11 public Connection
$connection;
13 public function __construct(Connection
$conn)
15 $this->connection
= $conn;
19 * Return a list of channels users.
21 * @return stdClass|array|bool
24 public function getAll(): stdClass
|array|bool
26 $response = $this->connection
->query('channel.list');
28 if(!is_bool($response)) {
29 return $response->list;
32 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
36 * Get a channel object
38 * @return stdClass|array|bool
40 public function get(string $channel): stdClass
|array|bool
42 $response = $this->connection
->query('channel.get', ['channel' => $channel]);
44 if (!is_bool($response)) {
45 return $response->channel
;
47 return false; /* eg user not found */
51 * Set and unset modes on a channel.
53 * @return stdClass|array|bool
55 public function set_mode(string $channel, string $modes, string $parameters): stdClass
|array|bool
57 return $this->connection
->query('channel.set_mode', [
58 'channel' => $channel,
60 'parameters' => $parameters,
65 * Set the channel topic.
67 * @return stdClass|array|bool
69 public function set_topic(string $channel, string $topic,
70 string $set_by=null, string $set_at=null): stdClass
|array|bool
72 return $this->connection
->query('channel.set_topic', [
73 'channel' => $channel,
81 * Kick a user from the channel.
83 * @return stdClass|array|bool
85 public function kick(string $channel, string $nick, string $reason): stdClass
|array|bool
87 return $this->connection
->query('channel.kick', [
89 'channel' => $channel,