#!/usr/bin/haserl <%in p/common.cgi %> <% plugin="telegram" plugin_name="Отправить в Телеграм" page_title="Отправить в Телеграмm" params="enabled token as_attachment as_photo channel caption socks5_enabled" tmp_file=/tmp/${plugin}.conf config_file="${ui_config_dir}/${plugin}.conf" [ ! -f "$config_file" ] && touch $config_file if [ "POST" = "$REQUEST_METHOD" ]; then # parse values from parameters for _p in $params; do eval ${plugin}_${_p}=\$POST_${plugin}_${_p} sanitize "${plugin}_${_p}" done; unset _p ### Validation if [ "true" = "$telegram_enabled" ]; then [ -z "$telegram_token" ] && flash_append "danger" "Токен Telegram не может быть пустым." && error=11 [ -z "$telegram_channel" ] && flash_append "danger" "Канал Telegram не может быть пустым." && error=12 fi if [ -z "$error" ]; then # create temp config file :>$tmp_file for _p in $params; do echo "${plugin}_${_p}=\"$(eval echo \$${plugin}_${_p})\"" >>$tmp_file done; unset _p mv $tmp_file $config_file update_caminfo redirect_back "success" "Конфигурация ${plugin_name} обновлена." fi redirect_to $SCRIPT_NAME else include $config_file # Default values [ -z "$telegram_caption" ] && telegram_caption="%hostname, %datetime" fi %> <%in p/header.cgi %>
/start
чтобы начать сеанс./newbot
создать нового бота.