mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-25 00:37:34 +00:00
send_photo
This commit is contained in:
parent
ad5796dd08
commit
120866a805
11
bashbot.sh
11
bashbot.sh
@ -1,5 +1,5 @@
|
|||||||
# bashbot, the Telegram bot written in bash.
|
# bashbot, the Telegram bot written in bash.
|
||||||
# Written by @topkecleon.
|
# Written by @topkecleon and Juan Potato (@awkward_potato)
|
||||||
# http://github.com/topkecleon/bashbot
|
# http://github.com/topkecleon/bashbot
|
||||||
|
|
||||||
# Depends on JSON.sh (http://github.com/dominictarr/JSON.sh),
|
# Depends on JSON.sh (http://github.com/dominictarr/JSON.sh),
|
||||||
@ -12,12 +12,17 @@
|
|||||||
|
|
||||||
TOKEN=''
|
TOKEN=''
|
||||||
URL='https://api.telegram.org/bot'$TOKEN
|
URL='https://api.telegram.org/bot'$TOKEN
|
||||||
MSG_URL=$URL'/sendMessage?chat_id='
|
MSG_URL=$URL'/sendMessage'
|
||||||
|
PHO_URL=$URL'/sendPhoto'
|
||||||
UPD_URL=$URL'/getUpdates?offset='
|
UPD_URL=$URL'/getUpdates?offset='
|
||||||
OFFSET=0
|
OFFSET=0
|
||||||
|
|
||||||
function send_message {
|
function send_message {
|
||||||
res=$(curl --data-urlencode "text=$2" "$MSG_URL$1&")
|
res=$(curl "$MSG_URL" -F "chat_id=$1" -F "text=$2")
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_photo() {
|
||||||
|
res=$(curl "$PHO_URL" -F "chat_id=$1" -F "photo=@$2")
|
||||||
}
|
}
|
||||||
|
|
||||||
while true; do {
|
while true; do {
|
||||||
|
Loading…
Reference in New Issue
Block a user