Skip to content

Commit 19e58d0

Browse files
committed
Version++ (1.2.0)
1 parent d51a79e commit 19e58d0

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/JoinEventHandler.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@ public function __construct($bot, $logger, JoinEvent $joinEvent)
4646

4747
public function handle()
4848
{
49+
if ($this->joinEvent->isGroupEvent()) {
50+
$id = $this->joinEvent->getGroupId();
51+
} elseif ($this->joinEvent->isRoomEvent()) {
52+
$id = $this->joinEvent->getRoomId();
53+
} else {
54+
$this->logger->error("Unknown event type");
55+
return;
56+
}
57+
4958
$this->bot->replyText(
5059
$this->joinEvent->getReplyToken(),
51-
sprintf('Joined %s %s', $this->joinEvent->getType(), $this->joinEvent->getUserId())
60+
sprintf('Joined %s %s', $this->joinEvent->getType(), $id)
5261
);
5362
}
5463
}

examples/KitchenSink/src/LINEBot/KitchenSink/EventHandler/LeaveEventHandler.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ public function __construct($bot, $logger, LeaveEvent $leaveEvent)
4646

4747
public function handle()
4848
{
49-
$this->bot->replyText(
50-
$this->leaveEvent->getReplyToken(),
51-
sprintf('Leaved %s %s', $this->leaveEvent->getType(), $this->leaveEvent->getUserId())
52-
);
49+
if ($this->leaveEvent->isGroupEvent()) {
50+
$id = $this->leaveEvent->getGroupId();
51+
} elseif ($this->leaveEvent->isRoomEvent()) {
52+
$id = $this->leaveEvent->getRoomId();
53+
} else {
54+
$this->logger->error("Unknown event type");
55+
return;
56+
}
57+
58+
$this->logger->info(sprintf('Leaved %s %s', $this->leaveEvent->getType(), $id));
5359
}
5460
}

src/LINEBot/Constant/Meta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020

2121
class Meta
2222
{
23-
const VERSION = '1.1.0';
23+
const VERSION = '1.2.0';
2424
}

0 commit comments

Comments
 (0)