From db6497896505e79df2fedf655efbb893b340a56c Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 11 Apr 2019 13:53:01 +0200 Subject: [PATCH] factor out help and info message --- commands.sh | 40 +++++++++++++++++++++++++--------------- version | 3 ++- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/commands.sh b/commands.sh index a596c59..9cc6db7 100755 --- a/commands.sh +++ b/commands.sh @@ -4,7 +4,7 @@ # This file is public domain in the USA and all free countries. # 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=SC2034 @@ -18,6 +18,28 @@ export 'LANGUAGE=C.UTF-8' unset IFS # 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 # Place the token in the token file TOKEN="$(cat token)" @@ -92,23 +114,11 @@ else ################################################ # DEFAULT commands start here, edit messages only '/info') - send_markdown_message "${CHAT[ID]}" "This is bashbot, the *Telegram* bot written entirely in *bash*." + bashbot_info "${CHAT[ID]}" ;; '/start') send_action "${CHAT[ID]}" "typing" - send_markdown_message "${CHAT[ID]}" "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. -*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) -" + bashbot_help "${CHAT[ID]}" ;; '/leavechat') diff --git a/version b/version index f1c3725..190e3e2 100755 --- a/version +++ b/version @@ -1,6 +1,6 @@ #!/bin/bash # -#### $$VERSION$$ v0.6-dev2-8-g649fe44 +#### $$VERSION$$ v0.6-dev2-9-gf4e277b # shellcheck disable=SC2016 # # Easy Versioning in git: @@ -48,6 +48,7 @@ do sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file" done # try to compile README.txt +echo -n " README.txt" pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt echo " done."