-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbot_triggers.php
More file actions
27 lines (22 loc) · 847 Bytes
/
bot_triggers.php
File metadata and controls
27 lines (22 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
use App\Event;
use App\Telegram;
// Event Triggers
$config = require __DIR__.'/config.php';
$bot = new Telegram($config);
if (!is_array($update)) {
die('Update is not set');
}
if (array_key_exists('text', $update['message'])) {
// Event: text
Event::trigger('text', [$update['message']['text'], $bot, $update]);
} elseif (array_key_exists('sticker', $update['message'])) {
// Event: sticker
Event::trigger('sticker', [$update['message']['sticker'], $bot, $update]);
} elseif (array_key_exists('photo', $update['message'])) {
// Event: photo
Event::trigger('photo', [$update['message']['photo'], $bot, $update]);
} elseif (array_key_exists('new_chat_member', $update['message'])) {
// Event: new_chat_member
Event::trigger('new_chat_member', [$update['message']['new_chat_member'], $bot, $update]);
}