audiokeychain-clients/bot/commands.sh

48 lines
1.7 KiB
Bash
Raw Normal View History

2016-06-19 00:56:20 +02:00
#!/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='/home/user/allowed/.*'
else
if ! tmux ls | grep -v send | grep -q $copname; then
2016-07-03 14:38:24 +02:00
TOCHECK="${URLS[AUDIO]} ${URLS[DOCUMENT]}"
[ ! -z $TOCHECK ] && {
send_action "${CHAT[ID]}" "typing"
# send_message "${CHAT[ID]}" "Initiating recognition process..."
curl -s $TOCHECK -o /tmp/$ME$NAME
CHECKRES="$(../audiokeychain.sh "/tmp/$ME$NAME")"
#[ ! -z $CHECKRES ] &&
res=$(curl -s "$MSG_URL" -d "chat_id=${CHAT[ID]}" -d "text=$(urlencode "$CHECKRES")" -d "reply_to_message_id=$MESSAGE_ID")
2016-06-19 00:56:20 +02:00
rm "/tmp/$ME$NAME"
2016-06-19 01:25:43 +02:00
return
2016-06-19 00:56:20 +02:00
}
fi
case $MESSAGE in
'/info')
send_markdown_message "${CHAT[ID]}" "This is bashbot, the *Telegram* bot written entirely in *bash*."
;;
2016-07-03 14:38:24 +02:00
'/start')
send_action "${CHAT[ID]}" "typing"
2016-06-19 01:25:43 +02:00
send_message "${CHAT[ID]}" "This bot can recognize the musical key and the bpm (beats per minute) of any song.
2016-06-19 00:56:20 +02:00
To start, send me an audio file in mp3 or wav format smaller than 15 megabytes.
2016-06-19 01:25:43 +02:00
Available commands:
• /start: Start bot and get this message.
2016-06-19 00:56:20 +02:00
This bot uses audiokeychain.com to recognize the songs. Both the audiokeychain client and the bot is written by Daniil Gentili (@danogentili).
2016-07-03 14:38:24 +02:00
Check out my other bots: @video_dl_bot, @mklwp_bot, @caption_ai_bot, @cowsaysbot, @cowthinksbot, @figletsbot, @lolcatzbot, @filtersbot, @id3bot, @pwrtelegrambot, @lennysbot
2016-06-19 01:25:43 +02:00
Source code: https://github.com/danog/audiokeychain-clients
2016-06-19 00:56:20 +02:00
"
;;
esac
fi