diff --git a/bash/captionbot.sh b/bash/captionbot.sh index 2562e62..f54cfd5 100755 --- a/bash/captionbot.sh +++ b/bash/captionbot.sh @@ -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 diff --git a/bash/commands.sh b/bash/commands.sh index c994ad0..07cbf45 100755 --- a/bash/commands.sh +++ b/bash/commands.sh @@ -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 }