1
0
mirror of https://github.com/danog/id3bot.git synced 2024-11-26 11:54:43 +01:00
id3bot/commands.sh
Daniil Gentili 8a8cd3c9db Rewrite
2016-07-03 17:41:14 +02:00

78 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Edit your commands in this file.
# Licensed under gplv3
if [ "$1" = "source" ];then
# Place the token in the token file
TOKEN=$(cat token)
# 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='.*'
else
if ! tmux ls | grep -v send | grep -q $copname; then
[ ! -z ${LOCATION[*]} ] && send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}"
# Inline
if [ $INLINE == 1 ]; then
# inline query data
iUSER[FIRST_NAME]=$(echo "$res" | sed 's/^.*\(first_name.*\)/\1/g' | cut -d '"' -f3 | tail -1)
iUSER[LAST_NAME]=$(echo "$res" | sed 's/^.*\(last_name.*\)/\1/g' | cut -d '"' -f3)
iUSER[USERNAME]=$(echo "$res" | sed 's/^.*\(username.*\)/\1/g' | cut -d '"' -f3 | tail -1)
iQUERY_ID=$(echo "$res" | sed 's/^.*\(inline_query.*\)/\1/g' | cut -d '"' -f5 | tail -1)
iQUERY_MSG=$(echo "$res" | sed 's/^.*\(inline_query.*\)/\1/g' | cut -d '"' -f5 | tail -6 | head -1)
# Inline examples
if [[ $iQUERY_MSG == photo ]]; then
answer_inline_query "$iQUERY_ID" "photo" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg" "http://blog.techhysahil.com/wp-content/uploads/2016/01/Bash_Scripting.jpeg"
fi
if [[ $iQUERY_MSG == sticker ]]; then
answer_inline_query "$iQUERY_ID" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC"
fi
if [[ $iQUERY_MSG == gif ]]; then
answer_inline_query "$iQUERY_ID" "cached_gif" "BQADBAADIwYAAmwsDAABlIia56QGP0YC"
fi
if [[ $iQUERY_MSG == web ]]; then
answer_inline_query "$iQUERY_ID" "article" "Telegram" "https://telegram.org/"
fi
fi
fi
case $MESSAGE in
'/info')
send_message "${USER[ID]}" "This is bashbot, the Telegram bot written entirely in bash."
;;
'/start')
send_message "${USER[ID]}" "This bot can be used to edit the id3 tags of audio files.
Available commands:
• /start: Start bot and start editing process.
• /cancel: Cancel any currently running interactive chats.
• /artist "ARTIST" Set the artist information
• /album "ALBUM" Set the album title information
• /song "SONG" Set the song title information
• /comment "DESCRIPTION":"COMMENT":"LANGUAGE" Set the comment information (both description and language optional)
• /genre num Set the genre number
• /year num Set the year
• /track num/num Set the track number/(optional) total tracks
• /art URL or image Set the album art.
• /done End the process
Written by Daniil Gentili (@danogentili, https://daniil.it).
Check out my other bots: @video_dl_bot, @mklwp_bot, @caption_ai_bot, @cowsaysbot, @cowthinksbot, @figletsbot, @lolcatzbot, @filtersbot, @id3bot, @pwrtelegrambot
https://github.com/danog/id3bot
"
startproc "./question"
;;
'/cancel')
if tmux ls | grep -q $copname; then killproc && send_message "${USER[ID]}" "Command canceled.";else send_message "${USER[ID]}" "No command is currently running.";fi
;;
*)
if tmux ls | grep -v send | grep -q $copname;then inproc; fi
;;
esac
fi