-
Notifications
You must be signed in to change notification settings - Fork 30
/
chat.php
60 lines (45 loc) · 2.02 KB
/
chat.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
require_once 'vendor/autoload.php';
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
$config = [
// Your driver-specific configuration
// "telegram" => [
// "token" => "TOKEN"
// ]
];
DriverManager::loadDriver(\BotMan\Drivers\Web\WebDriver::class);
$botman = BotManFactory::create($config);
// Give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
$bot->reply('Hey There.');
});
$botman->hears('Good Morning', function (BotMan $bot) {
$bot->reply('Good Morning to you too');
});
$botman->hears('How can I register myself into an event?', function (BotMan $bot) {
$bot->reply('Click on the event in which you wish to register. Then a form
will appear. Fill in that form. and submit. TaDa You are successfully registered');
});
$botman->hears('How to get to know about the upcoming events?', function (BotMan $bot) {
$bot->reply('All the upcoming events are shown on the homepage of the Website. If you
wish to see any particular event, you can filter the page accordingly');
});
$botman->hears('What is the last day of registration for this ‘particular’ event?', function (BotMan $bot) {
$bot->reply('Please check your email. We have sent you the timings and the venue');
});
$botman->hears('What are the various modes of payment for registering into an event?', function (BotMan $bot) {
$bot->reply('That depends on the event you are registering in');
});
$botman->hears('what is the time in {city} located in {continent}' , function (BotMan $bot,$city,$continent) {
date_default_timezone_set("$continent/$city");
$reply = "The time in ".$city." ".$continent." is ".date("h:i:sa");
$bot->reply($reply);
});
$botman->fallback(function($bot) {
$bot->reply('Sorry, I did not understand these commands. If you are facing any problem please tell us so that our team can reach back to you asap. Tell us your email address?');
});
// Start listening
$botman->listen();
?>