mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
0.96-dev3, update tests and docs for new features
This commit is contained in:
parent
dddd1ce2de
commit
2a66ee928f
@ -139,6 +139,7 @@ Written by Drew (@topkecleon), Daniil Gentili (@danogentili), and Kay M (@gnadel
|
||||
<li>Sending Messages, Files, Keyboards</li>
|
||||
<li>User Access Control</li>
|
||||
<li>Inline Queries</li>
|
||||
<li>jsshDB Bashbot key-value storage</li>
|
||||
<li>Background and Interactive Jobs</li>
|
||||
</ul></li>
|
||||
<li><a href="doc/7_develop.md">Deveoper Notes</a>
|
||||
@ -230,6 +231,6 @@ It features background tasks and interactive chats, and can serve as an interfac
|
||||
<p>@Gnadelwartz</p>
|
||||
<h2>That's it!</h2>
|
||||
<p>If you feel that there's something missing or if you found a bug, feel free to submit a pull request!</p>
|
||||
<h4>$$VERSION$$ 0.96-dev2-0-gcbad540</h4>
|
||||
<h4>$$VERSION$$ v0.96-dev3-0-gdddd1ce</h4>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -52,6 +52,7 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
|
||||
* Sending Messages, Files, Keyboards
|
||||
* User Access Control
|
||||
* Inline Queries
|
||||
* jsshDB Bashbot key-value storage
|
||||
* Background and Interactive Jobs
|
||||
* [Deveoper Notes](doc/7_develop.md)
|
||||
* Debug bashbot
|
||||
@ -197,4 +198,4 @@ This may happen if to many wrong requests are sent to api.telegram.org, e.g. usi
|
||||
|
||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||
|
||||
#### $$VERSION$$ 0.96-dev2-0-gcbad540
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
@ -65,6 +65,7 @@ availible on www.github.com
|
||||
* Sending Messages, Files, Keyboards
|
||||
* User Access Control
|
||||
* Inline Queries
|
||||
* jsshDB Bashbot key-value storage
|
||||
* Background and Interactive Jobs
|
||||
* [Deveoper Notes](doc/7_develop.md)
|
||||
* Debug bashbot
|
||||
@ -280,4 +281,4 @@ in 'mycommands.sh' as example.
|
||||
If you feel that there's something missing or if you found a bug, feel free to
|
||||
submit a pull request!
|
||||
|
||||
#### $$VERSION$$ 0.96-dev2-0-gcbad540
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
@ -22,17 +22,22 @@ Have FUN!
|
||||
├── mycommands.sh.clean # copy to "mycommands.sh" if you start devloping your bot
|
||||
├── mycommands.sh.dist # example bot, also used for testing bashbot internally
|
||||
│
|
||||
├── count.jssh # count bashbot usage in jssh key-value store
|
||||
├── blocked.jssh # list of blocked USER[ID] in jssh key-value store
|
||||
│
|
||||
├── bashbot.sh # main bashbot script - DO NOT EDIT!
|
||||
├── commands.sh # command dispatcher - DO NOT EDIT!
|
||||
├── JSON.sh # bashbots JSON parser, see https://github.com/dominictarr/JSON.sh
|
||||
│
|
||||
├── scripts # place your bashbot interactive and background scripts hereh
|
||||
│
|
||||
├── modules # optional functions, sourced by commands.sh
|
||||
│ ├── aliases.sh # to disable modules rename them xxx.sh.off
|
||||
│ ├── answerInline.sh
|
||||
│ ├── jsshDB.sh # read and store JSON.sh stlye JSON
|
||||
│ ├── jsshDB.sh # read and store JSON.sh stlye JSON, mandatory
|
||||
│ ├── background.sh # interactive and background functions
|
||||
│ ├── chatMember.sh
|
||||
│ └── sendMessage.sh # main send message functions, do not disable
|
||||
│ └── sendMessage.sh # main send message functions, mandatory
|
||||
│
|
||||
├── addons # optional addons, disbaled by default
|
||||
│ ├── example.sh # to enable addons change their XXX_ENABLE to true
|
||||
@ -241,5 +246,5 @@ send_action "${CHAT[ID]}" "action"
|
||||
#### [Prev Create Bot](1_firstbot.md)
|
||||
#### [Next Advanced Usage](3_advanced.md)
|
||||
|
||||
#### $$VERSION$$ v0.96-dev-7-g0153928
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ 0.96-dev2-10-ged373a8
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
||||
# common variables
|
||||
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME
|
||||
@ -32,8 +32,9 @@ export INPUTFILE REFFILE OUTPUTFILE
|
||||
OUTPUTFILE="${TESTDIR}/${REFDIR}.out"
|
||||
|
||||
# do not query telegram when testing
|
||||
export BASHBOT_URL
|
||||
export BASHBOT_URL TESTTOKEN
|
||||
BASHBOT_URL="https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?"
|
||||
TESTTOKEN="123456789:BASHBOTTESTSCRIPTbashbottestscript_"
|
||||
|
||||
# print arrays in reproducible order
|
||||
print_array() {
|
||||
|
@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ 0.96-dev2-10-ged373a8
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
source "./ALL-tests.inc.sh"
|
||||
|
||||
TESTTOKEN="bashbottestscript"
|
||||
TESTFILES="${TOKENFILE} ${ACLFILE} ${COUNTFILE} ${ADMINFILE}"
|
||||
TESTFILES="${TOKENFILE} ${ACLFILE} ${COUNTFILE} ${BLOCKEDFILE} ${ADMINFILE}"
|
||||
|
||||
set -e
|
||||
|
||||
@ -46,5 +45,5 @@ cd "${DIRME}" || exit 1
|
||||
echo "${SUCCESS}"
|
||||
|
||||
echo "Test bashbot.sh count"
|
||||
#cp "${REFDIR}/count.test" "${TESTDIR}/counti.jssh"
|
||||
#"${TESTDIR}/bashbot.sh" count
|
||||
cp "${REFDIR}/count.test" "${TESTDIR}/count.jssh"
|
||||
"${TESTDIR}/bashbot.sh" count
|
||||
|
27
test/c-init-test/count.test
Normal file
27
test/c-init-test/count.test
Normal file
@ -0,0 +1,27 @@
|
||||
["counted_user_id"] "num_messages_seen"
|
||||
["712677"] "2"
|
||||
["-1001189446"] "29"
|
||||
["-1001288661"] "6"
|
||||
["-1001433755"] "4"
|
||||
["-408138"] "2"
|
||||
["1246831"] "7"
|
||||
["-1001186489"] "4"
|
||||
["-1001259400"] "8"
|
||||
["791626"] "18"
|
||||
["-1001293952"] "4"
|
||||
["-1001435141"] "7"
|
||||
["733039"] "2"
|
||||
["-1001319011"] "6"
|
||||
["-1001220313"] "15"
|
||||
["26122"] "3"
|
||||
["988411"] "8"
|
||||
["908527"] "6"
|
||||
["-1001450413"] "58"
|
||||
["748933"] "2"
|
||||
["-1001425571"] "5"
|
||||
["788295"] "3"
|
||||
["586928"] "45"
|
||||
["-1001359971"] "7"
|
||||
["1069707"] "19"
|
||||
["-1001189446"] "30"
|
||||
["-1001189446"] "31"
|
@ -1 +1 @@
|
||||
bashbottestscript
|
||||
123456789:BASHBOTTESTSCRIPTbashbottestscript_
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ 0.96-dev2-10-ged373a8
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
@ -34,7 +34,7 @@ USER[ID]="123456789"
|
||||
CHAT[ID]="123456789"
|
||||
|
||||
# output processed input
|
||||
print_array "USER" "CHAT" "REPLYTO" "FORWARD" "URLS" "CONTACT" "CAPTION" "LOCATION" "MESSAGE" "VENUE" >"${OUTPUTFILE}"
|
||||
print_array "USER" "CHAT" "REPLYTO" "FORWARD" "URLS" "CONTACT" "CAPTION" "LOCATION" "MESSAGE" "VENUE" "SERVICE">"${OUTPUTFILE}"
|
||||
diff -c "${REFFILE}" "${OUTPUTFILE}" || exit 1
|
||||
echo "${SUCCESS}"
|
||||
|
||||
|
@ -89,3 +89,16 @@
|
||||
["result",0,"message","voice","duration"] 2
|
||||
["result",0,"message","voice","mime_type"] "audio/ogg"
|
||||
["result",0,"message","voice","file_size"] 4262
|
||||
["result",0,"message","new_chat_participant","id"] 123456789
|
||||
["result",0,"message","new_chat_participant","is_bot"] false
|
||||
["result",0,"message","new_chat_participant","first_name"] "Kay"
|
||||
["result",0,"message","new_chat_participant","last_name"] "M"
|
||||
["result",0,"message","new_chat_member","id"] 123456789
|
||||
["result",0,"message","new_chat_member","is_bot"] false
|
||||
["result",0,"message","new_chat_member","first_name"] "Kay"
|
||||
["result",0,"message","new_chat_member","last_name"] "M"
|
||||
["result",0,"message","new_chat_members",0,"id"] 123456789
|
||||
["result",0,"message","new_chat_members",0,"is_bot"] false
|
||||
["result",0,"message","new_chat_members",0,"first_name"] "Kay"
|
||||
["result",0,"message","new_chat_members",0,"last_name"] "M"
|
||||
["result",0,"message","left_chat_member","id"] 123456789
|
||||
|
@ -42,3 +42,9 @@ VENUE: FOURSQUARE 4c4321afce54e21eee980d1a
|
||||
VENUE: LATITUDE 49.631824
|
||||
VENUE: LONGITUDE 8.377072
|
||||
VENUE: TITLE Kolb's Biergarten
|
||||
SERVICE: 0 yes
|
||||
SERVICE: LEFTMEMBER 123456789
|
||||
SERVICE: NEWMEMBER 123456789
|
||||
SERVICE: NEWPHOTO
|
||||
SERVICE: NEWTILE
|
||||
SERVICE: PINNED
|
||||
|
@ -1,64 +1,64 @@
|
||||
chat:123456 JSON:"text":"\# test for text only output"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"This is a normal text"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"This is a normal text
|
||||
with a line break"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":" This is a <b>HTML<\/b> text","parse_mode":"html"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":" This is a <b>HTML<\/b> text
|
||||
with a line break","parse_mode":"html"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":" This is a \*MARKDOWN\* text","parse_mode":"markdown"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":" This is a \*MARKDOWN\* text
|
||||
with a line break","parse_mode":"markdown"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"\# test for keyboard\, file\, venue output"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"Text plus keyboard will appear in chat", "reply_markup": {"keyboard": [ [ "Yep, sure" , "No, highly unlikely" ] ] , "one_time_keyboard":true}
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"latitude": la10, "longitude": lo20
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendLocation
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendLocation
|
||||
|
||||
chat:123456 JSON:"latitude": la10, "longitude": lo20, "address": "Diagon Alley N. 37", "title": "my home"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendVenue
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendVenue
|
||||
|
||||
chat:123456 JSON:"text":"\# test for new inline button"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"Text plus keyboard will appear in chat", "reply_markup": {"inline_keyboard": [ [ {"text":"Button Text", "url":"https://www..."}] ]}
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"STABILO 88\/240 Fineliner point 88
|
||||
|
||||
[https:\/\/images\-na.ssl\-images\-amazon.com\/images\/I\/41oypA3kmHL.l_SX300.jpg]
|
||||
[https:\/\/images\-na\.ssl\-images\-amazon\.com\/images\/I\/41oypA3kmHL\.l_SX300\.jpg]
|
||||
second part of text
|
||||
plus newline.", "reply_markup": {"inline_keyboard": [ [ {"text":"Bei Amazon ansehen ...", "url":"https://www.amazon.de/dp/B014TN3JYW"}] ]}
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
plus newline\.", "reply_markup": {"inline_keyboard": [ [ {"text":"Bei Amazon ansehen \.\.\.", "url":"https://www.amazon.de/dp/B014TN3JYW"}] ]}
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"text":"\# test for sendfile"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendMessage
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendMessage
|
||||
|
||||
chat:123456 JSON:"photo":"/tmp/allowed/this_is_my.gif","caption":"Text plus absolute file will appear in chat"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendPhoto
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendPhoto
|
||||
|
||||
chat:123456 JSON:"action": "upload_photo"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendChatAction
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendChatAction
|
||||
|
||||
chat:123456 JSON:"document":"/tmp/allowed/this_is_my.doc","caption":"Text plus absolute file will appear in chat"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendDocument
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendDocument
|
||||
|
||||
chat:123456 JSON:"action": "upload_document"
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?bashbottestscript/sendChatAction
|
||||
URL:https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?123456789:BASHBOTTESTSCRIPTbashbottestscript_/sendChatAction
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.96-dev-7-g0153928
|
||||
#### $$VERSION$$ v0.96-dev3-0-gdddd1ce
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
@ -33,7 +33,6 @@ cp ${TESTDIR}/*commands.sh "${BASHBOT_ETC}" || exit 1
|
||||
set -f
|
||||
cp -r "${TESTDIR}/bashbot.sh" "${TESTDIR}/modules" "${BASHBOT_BIN}" || exit 1
|
||||
|
||||
TESTTOKEN="bashbottestscript"
|
||||
TESTFILES="${TOKENFILE} ${ACLFILE} ${ADMINFILE}"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user