D
D
Dmitriy_dmitriy2017-06-06 13:17:47
PHP
Dmitriy_dmitriy, 2017-06-06 13:17:47

How to parse a schedule from a database into a telegram bot?

Hello! There is a site from which you need to parse the site schedule in the telegram bot. I made menus with the choice of course and group, but I can’t figure out how to display the schedule itself. Please tell me.
Sample bot code:

bot
if ($text == "/rasp" || $text == "Расписание") {
$option = array( array("Дневное отделение"), array("Вечернее отделение"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите отделение:");
$telegram->sendMessage($content);
}
 if ($text == "/dn" || $text == "Дневное отделение") {
$option = array( array("1 Курс", "2 Курс"), array("3 Курс", "4 Курс"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите курс:");
$telegram->sendMessage($content);
}
 if ($text == "/dn_1" || $text == "1 Курс") {
$option = array( array("ПАП-59"), array("ПАП-60"), array("ЭВМ-118"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите группу:");
$telegram->sendMessage($content);
}
 if ($text == "/dn_2" || $text == "2 Курс") {
$option = array( array("ПАП-57"), array("ПАП-58"), array("ЭВМ-116"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите группу:");
$telegram->sendMessage($content);
}
 if ($text == "/dn_3" || $text == "3 Курс") {
$option = array( array("ПАП-55"), array("ПАП-56"), array("ЭВМ-114"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите группу:");
$telegram->sendMessage($content);
}
 if ($text == "/dn_4" || $text == "4 Курс") {
$option = array( array("ПАП-53"), array("ПАП-54"), array("ЭВМ-113"), array("Главное меню") );
$keyb = $telegram->buildKeyBoard($option, $onetime=true);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Выберите группу:");
$telegram->sendMessage($content);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey S., 2017-06-06
@Winsik

Something tells me that a picture is most suitable
or output through codefor even columns, but since the width of the phones is different, it will still transfer to other lines (or make a very narrow width)
as an option to display the buttons Mon-Tue-Wed-Thurs -Fri-Sat (keyboardmarkup)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question