Updated bot

This commit is contained in:
Daniil Gentili 2016-04-19 19:52:30 +02:00
parent c85f851c0d
commit f4f1600217
2 changed files with 8 additions and 3 deletions

View File

@ -42,6 +42,8 @@ result=$(curl -s https://www.captionbot.ai/api/message -H "Content-Type: applica
watermark=$(echo "$result" | sed '/\["WaterMark"\]/!d;s/\["WaterMark"\]\t//g')
message=$(echo "$result" | sed '/\[".*Message"\]/!d;s/\[".*Message"\]\t//g;s/^"//g;s/"$//g;s/\\n/ /g')
[ "$2" = "script" ] && echo "$message" | grep -q "I really can't describe the picture" && exit 1
echo $message
[ "$2" = "script" ] && exit

View File

@ -3,16 +3,19 @@
if [ "$1" = "source" ];then
# Edit the token in here
# Set INLINE to 1 in order to receive inline queries.
# Set INLINE to 1 in order to receive inline queries.
# To enable this option in your bot, send the /setinline command to @BotFather.
INLINE=0
# Set to .* to allow sending files from all locations
FILE_REGEX='/home/user/allowed/.*'
else
ALLOW="${URLS[PHOTO]} ${URLS[STICKER]} ${URLS[DOCUMENT]}"
if ! tmux ls | grep -v send | grep -q $copname; then
[ ! -z ${URLS[*]} ] && {
[ ! -z $ALLOW ] && {
send_action ${USER[ID]} typing
result=$(./captionbot.sh ${URLS[*]} script)
convert $ALLOW $NAME.jpg
result=$(./captionbot.sh $NAME script)
rm $NAME
res=$(curl -s "$MSG_URL" -d "chat_id=${USER[ID]}" -d "text=$result" -d "reply_to_message_id=$MESSAGE_ID")
return
}