From 8c557bac81dbf73b854e9587ae5a8efdaaef35eb Mon Sep 17 00:00:00 2001 From: ArteQ Date: Mon, 10 Oct 2016 23:44:32 +0200 Subject: [PATCH] manually set new DirectMessageChannel Usefull when in client code you first need to call 'im.open' and then send message to this newly created DM. Since this new DM does not exists in $this->dms at that moment sending message to that channel will fail. --- src/RealTimeClient.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/RealTimeClient.php b/src/RealTimeClient.php index be0480e..73fe544 100644 --- a/src/RealTimeClient.php +++ b/src/RealTimeClient.php @@ -254,6 +254,15 @@ public function getDMById($id) return Promise\resolve($this->dms[$id]); } + + /** + * Set new DM + * @param DirectMessageChannel $dm + */ + public function setDM(DirectMessageChannel $dm) + { + $this->dms[ $dm->getId() ] = $dm; + } /** * {@inheritDoc}