add test URL for getMe
This commit is contained in:
parent
f74e95ddcb
commit
31c6c4b111
47
README.html
47
README.html
|
@ -6,6 +6,43 @@
|
|||
<meta name="generator" content="pandoc" />
|
||||
<title>Bashbot README</title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<style type="text/css">
|
||||
div.sourceCode { overflow-x: auto; }
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
||||
table.sourceCode { width: 100%; line-height: 100%; }
|
||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
|
||||
code > span.dt { color: #902000; } /* DataType */
|
||||
code > span.dv { color: #40a070; } /* DecVal */
|
||||
code > span.bn { color: #40a070; } /* BaseN */
|
||||
code > span.fl { color: #40a070; } /* Float */
|
||||
code > span.ch { color: #4070a0; } /* Char */
|
||||
code > span.st { color: #4070a0; } /* String */
|
||||
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
|
||||
code > span.ot { color: #007020; } /* Other */
|
||||
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
|
||||
code > span.fu { color: #06287e; } /* Function */
|
||||
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
|
||||
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
|
||||
code > span.cn { color: #880000; } /* Constant */
|
||||
code > span.sc { color: #4070a0; } /* SpecialChar */
|
||||
code > span.vs { color: #4070a0; } /* VerbatimString */
|
||||
code > span.ss { color: #bb6688; } /* SpecialString */
|
||||
code > span.im { } /* Import */
|
||||
code > span.va { color: #19177c; } /* Variable */
|
||||
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
|
||||
code > span.op { color: #666666; } /* Operator */
|
||||
code > span.bu { } /* BuiltIn */
|
||||
code > span.ex { } /* Extension */
|
||||
code > span.pp { color: #bc7a00; } /* Preprocessor */
|
||||
code > span.at { color: #7d9029; } /* Attribute */
|
||||
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
|
||||
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
|
||||
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
|
||||
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
|
@ -109,9 +146,17 @@
|
|||
<h3 id="can-i-have-the-single-bashbot.sh-file-back">Can I have the single bashbot.sh file back?</h3>
|
||||
<p>At the beginning bashbot was simply the file <code>bashbot.sh</code> you can copy everywhere and run the bot. Now we have ‘commands.sh’, ‘mycommands.sh’, ’modules/*.sh’ and much more.</p>
|
||||
<p>Hey no Problem, if you are finished with your cool bot run <code>dev/make-standalone.sh</code> to create a stripped down Version of your bot containing only ‘bashbot.sh’ and ‘commands.sh’! For more information see <a href="doc/7_develop.md">Create a stripped down Version of your Bot</a></p>
|
||||
<h3 id="why-do-i-get-expected-value-got-eof-on-start">Why do I get “EXPECTED value GOT EOF” on start?</h3>
|
||||
<p>May be your IP is blocked by telegram. You can test this by running curl or wget manually:</p>
|
||||
<div class="sourceCode"><pre class="sourceCode bash"><code class="sourceCode bash"><span class="ex">curl</span> -m 10 https://api.telegram.org/bot
|
||||
<span class="co">#curl: (28) Connection timed out after 10001 milliseconds</span>
|
||||
|
||||
<span class="fu">wget</span> -t 1 -T 10 https://api.telegram.org/bot
|
||||
<span class="co">#Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443... failed: Connection timed out.</span></code></pre></div>
|
||||
<p>This may happen if to many wrong requests are sent to api.telegram.org, e.g. using a wrong token or not existing API calls. If you have a fixed IP you can ask telegram service to unblock your ip or change your IP. If you are running a tor proxy on your server you may uncomment the <code>BASHBOT_CURL_ARGS</code> line in ‘mycommands.sh’</p>
|
||||
<p><span class="citation">@Gnadelwartz</span></p>
|
||||
<h2 id="thats-it">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 id="version-v0.90-dev-3-g80a4778"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.90-dev-3-g80a4778</h4>
|
||||
<h4 id="version-v0.90-dev-8-gf74e95d"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.90-dev-8-gf74e95d</h4>
|
||||
</body>
|
||||
</html>
|
||||
|
|
12
README.md
12
README.md
|
@ -104,16 +104,16 @@ At the beginning bashbot was simply the file ```bashbot.sh``` you can copy every
|
|||
Hey no Problem, if you are finished with your cool bot run ```dev/make-standalone.sh``` to create a stripped down Version of your bot containing only
|
||||
'bashbot.sh' and 'commands.sh'! For more information see [Create a stripped down Version of your Bot](doc/7_develop.md)
|
||||
|
||||
### I get "EXPECTED value GOT EOF" on start
|
||||
May be your IP is blocked by telgram and curl/wget reach it's timeout (default 20s in bashbot). You can test this by running curl or wget manually:
|
||||
### Why do I get "EXPECTED value GOT EOF" on start?
|
||||
May be your IP is blocked by telegram. You can test this by running curl or wget manually:
|
||||
```bash
|
||||
curl -m 10 https://api.telegram.org/bot
|
||||
curl: (28) Connection timed out after 10001 milliseconds
|
||||
#curl: (28) Connection timed out after 10001 milliseconds
|
||||
|
||||
wget -t 1 -T 10 https://api.telegram.org/bot
|
||||
Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443... failed: Connection timed out.
|
||||
#Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443... failed: Connection timed out.
|
||||
```
|
||||
This may happen if someone send to many wrong requests, e.g. wrong bot token, to api.telegram.org. If you have a fixed IP you can ask telegram service to unblock your ip or change your IP. If you are running a tor proxy on your server you may uncomment the 'BASHBOT_CURL_ARGS' line in 'mycommands.sh'
|
||||
This may happen if to many wrong requests are sent to api.telegram.org, e.g. using a wrong token or not existing API calls. If you have a fixed IP you can ask telegram service to unblock your ip or change your IP. If you are running a tor proxy on your server you may uncomment the ```BASHBOT_CURL_ARGS``` line in 'mycommands.sh'
|
||||
|
||||
|
||||
@Gnadelwartz
|
||||
|
@ -122,4 +122,4 @@ This may happen if someone send to many wrong requests, e.g. wrong bot token, to
|
|||
|
||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.90-dev-3-g80a4778
|
||||
#### $$VERSION$$ v0.90-dev-8-gf74e95d
|
||||
|
|
19
README.txt
19
README.txt
|
@ -152,6 +152,23 @@ containing only
|
|||
'bashbot.sh' and 'commands.sh'! For more information see [Create a stripped
|
||||
down Version of your Bot](doc/7_develop.md)
|
||||
|
||||
### Why do I get "EXPECTED value GOT EOF" on start?
|
||||
May be your IP is blocked by telegram. You can test this by running curl or
|
||||
wget manually:
|
||||
```bash
|
||||
curl -m 10 https://api.telegram.org/bot
|
||||
#curl: (28) Connection timed out after 10001 milliseconds
|
||||
|
||||
wget -t 1 -T 10 https://api.telegram.org/bot
|
||||
#Connecting to api.telegram.org (api.telegram.org)|46.38.243.234|:443...
|
||||
failed: Connection timed out.
|
||||
```
|
||||
This may happen if to many wrong requests are sent to api.telegram.org, e.g.
|
||||
using a wrong token or not existing API calls. If you have a fixed IP you can
|
||||
ask telegram service to unblock your ip or change your IP. If you are running a
|
||||
tor proxy on your server you may uncomment the ```BASHBOT_CURL_ARGS``` line in
|
||||
'mycommands.sh'
|
||||
|
||||
|
||||
@Gnadelwartz
|
||||
|
||||
|
@ -160,4 +177,4 @@ down Version of your Bot](doc/7_develop.md)
|
|||
If you feel that there's something missing or if you found a bug, feel free to
|
||||
submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.90-dev-3-g80a4778
|
||||
#### $$VERSION$$ v0.90-dev-8-gf74e95d
|
||||
|
|
|
@ -11,7 +11,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.90-dev-6-gcb77d41
|
||||
#### $$VERSION$$ v0.90-dev-8-gf74e95d
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
|
@ -249,14 +249,14 @@ else
|
|||
# simple curl or wget call outputs result to stdout
|
||||
getJson(){
|
||||
# shellcheck disable=SC2086
|
||||
wget -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - "$1"
|
||||
wget -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - "$1"
|
||||
}
|
||||
# usage: sendJson "chat" "JSON" "URL"
|
||||
sendJson(){
|
||||
local chat="";
|
||||
[ "${1}" != "" ] && chat='"chat_id":'"${1}"','
|
||||
# shellcheck disable=SC2086
|
||||
res="$(wget -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - --post-data='{'"${chat} $2"'}' \
|
||||
res="$(wget -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - --post-data='{'"${chat} $2"'}' \
|
||||
--header='Content-Type:application/json' "${3}" | "${JSONSHFILE}" -s -b -n )"
|
||||
BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$res")"
|
||||
BOTSENT[ID]="$(JsonGetValue '"result","message_id"' <<< "$res")"
|
||||
|
@ -281,8 +281,7 @@ title2Json(){
|
|||
|
||||
# get bot name
|
||||
getBotName() {
|
||||
sendJson "" "" "$ME_URL"
|
||||
JsonGetString '"result","username"' <<< "$res"
|
||||
getJson "$ME_URL" | "${JSONSHFILE}" -s -b -n | JsonGetString '"result","username"'
|
||||
}
|
||||
|
||||
# pure bash implementaion, done by KayM (@gnadelwartz)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.90-dev-0-g75691dc
|
||||
#### $$VERSION$$ v0.90-dev-8-gf74e95d
|
||||
|
||||
# common variables
|
||||
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME
|
||||
|
@ -30,6 +30,10 @@ export INPUTFILE REFFILE OUTPUTFILE
|
|||
REFFILE="${DIRME}/${REFDIR}/${REFDIR}.result"
|
||||
OUTPUTFILE="${TESTDIR}/${REFDIR}.out"
|
||||
|
||||
# do not query telegram when testing
|
||||
export BASHBOT_URL
|
||||
BASHBOT_URL="https://my-json-server.typicode.com/topkecleon/telegram-bot-bash/getMe?"
|
||||
|
||||
# print arrays in reproducible order
|
||||
print_array() {
|
||||
local idx t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
iQUERY: 0 message
|
||||
iQUERY: FIRST_NAME Kay
|
||||
iQUERY: LAST_NAME M
|
||||
iQUERY: USERNAME Gnadelwartz
|
||||
iQUERY: USER_ID 123456789
|
||||
iQUERY: USERNAME Gnadelwartz
|
||||
|
|
Loading…
Reference in New Issue