| @@ 196-207 (lines=12) @@ | ||
| 193 | /** |
|
| 194 | * {@inheritDoc} |
|
| 195 | */ |
|
| 196 | public function getChannelById($id) |
|
| 197 | { |
|
| 198 | if (!$this->connected) { |
|
| 199 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 200 | } |
|
| 201 | ||
| 202 | if (!isset($this->channels[$id])) { |
|
| 203 | return Promise\reject(new ApiException("No channel exists for ID '$id'.")); |
|
| 204 | } |
|
| 205 | ||
| 206 | return Promise\resolve($this->channels[$id]); |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * {@inheritDoc} |
|
| @@ 224-235 (lines=12) @@ | ||
| 221 | /** |
|
| 222 | * {@inheritDoc} |
|
| 223 | */ |
|
| 224 | public function getGroupById($id) |
|
| 225 | { |
|
| 226 | if (!$this->connected) { |
|
| 227 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 228 | } |
|
| 229 | ||
| 230 | if (!isset($this->groups[$id])) { |
|
| 231 | return Promise\reject(new ApiException("No group exists for ID '$id'.")); |
|
| 232 | } |
|
| 233 | ||
| 234 | return Promise\resolve($this->groups[$id]); |
|
| 235 | } |
|
| 236 | ||
| 237 | /** |
|
| 238 | * {@inheritDoc} |
|
| @@ 252-263 (lines=12) @@ | ||
| 249 | /** |
|
| 250 | * {@inheritDoc} |
|
| 251 | */ |
|
| 252 | public function getDMById($id) |
|
| 253 | { |
|
| 254 | if (!$this->connected) { |
|
| 255 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 256 | } |
|
| 257 | ||
| 258 | if (!isset($this->dms[$id])) { |
|
| 259 | return Promise\reject(new ApiException("No DM exists for ID '$id'.")); |
|
| 260 | } |
|
| 261 | ||
| 262 | return Promise\resolve($this->dms[$id]); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * {@inheritDoc} |
|
| @@ 280-291 (lines=12) @@ | ||
| 277 | /** |
|
| 278 | * {@inheritDoc} |
|
| 279 | */ |
|
| 280 | public function getUserById($id) |
|
| 281 | { |
|
| 282 | if (!$this->connected) { |
|
| 283 | return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?')); |
|
| 284 | } |
|
| 285 | ||
| 286 | if (!isset($this->users[$id])) { |
|
| 287 | return Promise\reject(new ApiException("No user exists for ID '$id'.")); |
|
| 288 | } |
|
| 289 | ||
| 290 | return Promise\resolve($this->users[$id]); |
|
| 291 | } |
|
| 292 | ||
| 293 | /** |
|
| 294 | * {@inheritDoc} |
|