]>
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(int $object_detail_level=1): stdClass
|array|bool
26 $response = $this->connection
->query('channel.list', [
27 'object_detail_level' => $object_detail_level,
30 if(!is_bool($response)) {
31 return $response->list;
34 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
38 * Get a channel object
40 * @return stdClass|array|bool
42 public function get(string $channel, int $object_detail_level=3): stdClass
|array|bool
44 $response = $this->connection
->query('channel.get', [
45 'channel' => $channel,
46 'object_detail_level' => $object_detail_level,
49 if (!is_bool($response)) {
50 return $response->channel
;
52 return false; /* eg user not found */
56 * Set and unset modes on a channel.
58 * @return stdClass|array|bool
60 public function set_mode(string $channel, string $modes, string $parameters): stdClass
|array|bool
62 return $this->connection
->query('channel.set_mode', [
63 'channel' => $channel,
65 'parameters' => $parameters,
70 * Set the channel topic.
72 * @return stdClass|array|bool
74 public function set_topic(string $channel, string $topic,
75 string $set_by=null, string $set_at=null): stdClass
|array|bool
77 return $this->connection
->query('channel.set_topic', [
78 'channel' => $channel,
86 * Kick a user from the channel.
88 * @return stdClass|array|bool
90 public function kick(string $channel, string $nick, string $reason): stdClass
|array|bool
92 return $this->connection
->query('channel.kick', [
94 'channel' => $channel,