mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-26 09:16:28 +00:00
factor out help and info message
This commit is contained in:
parent
f4e277ba15
commit
db64978965
40
commands.sh
40
commands.sh
@ -4,7 +4,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.6-dev2-8-g649fe44
|
#### $$VERSION$$ v0.6-dev2-9-gf4e277b
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
@ -18,6 +18,28 @@ export 'LANGUAGE=C.UTF-8'
|
|||||||
unset IFS
|
unset IFS
|
||||||
# set -f # if you are paranoid use set -f to disable globbing
|
# set -f # if you are paranoid use set -f to disable globbing
|
||||||
|
|
||||||
|
|
||||||
|
# chnage Info anf Help to fit your needs
|
||||||
|
bashbot_info() {
|
||||||
|
send_markdown_message "${1}" 'This is bashbot, the Telegram bot written entirely in bash.
|
||||||
|
It features background tasks and interactive chats, and can serve as an interface for CLI programs.
|
||||||
|
It currently can send, recieve and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files.
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
bashbot_help() {
|
||||||
|
send_markdown_message "${1}" '*Available commands*:
|
||||||
|
*• /start*: _Start bot and get this message_.
|
||||||
|
*• /info*: _Get shorter info message about this bot_.
|
||||||
|
*• /question*: _Start interactive chat_.
|
||||||
|
*• /cancel*: _Cancel any currently running interactive chats_.
|
||||||
|
*• /kickme*: _You will be autokicked from the chat_.
|
||||||
|
*• /leavechat*: _The bot will leave the group with this command _.
|
||||||
|
Written by Drew (@topkecleon), Daniil Gentili (@danogentili) and KayM(@gnadelwartz).
|
||||||
|
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$1" = "source" ];then
|
if [ "$1" = "source" ];then
|
||||||
# Place the token in the token file
|
# Place the token in the token file
|
||||||
TOKEN="$(cat token)"
|
TOKEN="$(cat token)"
|
||||||
@ -92,23 +114,11 @@ else
|
|||||||
################################################
|
################################################
|
||||||
# DEFAULT commands start here, edit messages only
|
# DEFAULT commands start here, edit messages only
|
||||||
'/info')
|
'/info')
|
||||||
send_markdown_message "${CHAT[ID]}" "This is bashbot, the *Telegram* bot written entirely in *bash*."
|
bashbot_info "${CHAT[ID]}"
|
||||||
;;
|
;;
|
||||||
'/start')
|
'/start')
|
||||||
send_action "${CHAT[ID]}" "typing"
|
send_action "${CHAT[ID]}" "typing"
|
||||||
send_markdown_message "${CHAT[ID]}" "This is bashbot, the Telegram bot written entirely in bash.
|
bashbot_help "${CHAT[ID]}"
|
||||||
It features background tasks and interactive chats, and can serve as an interface for CLI programs.
|
|
||||||
It currently can send, recieve and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files.
|
|
||||||
*Available commands*:
|
|
||||||
*• /start*: _Start bot and get this message_.
|
|
||||||
*• /info*: _Get shorter info message about this bot_.
|
|
||||||
*• /question*: _Start interactive chat_.
|
|
||||||
*• /cancel*: _Cancel any currently running interactive chats_.
|
|
||||||
*• /kickme*: _You will be autokicked from the chat_.
|
|
||||||
*• /leavechat*: _The bot will leave the group with this command _.
|
|
||||||
Written by Drew (@topkecleon) and Daniil Gentili (@danogentili).
|
|
||||||
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
|
||||||
"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'/leavechat')
|
'/leavechat')
|
||||||
|
3
version
3
version
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.6-dev2-8-g649fe44
|
#### $$VERSION$$ v0.6-dev2-9-gf4e277b
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
#
|
#
|
||||||
# Easy Versioning in git:
|
# Easy Versioning in git:
|
||||||
@ -48,6 +48,7 @@ do
|
|||||||
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
|
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
|
||||||
done
|
done
|
||||||
# try to compile README.txt
|
# try to compile README.txt
|
||||||
|
echo -n " README.txt"
|
||||||
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
|
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
|
||||||
echo " done."
|
echo " done."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user