PhraseBot is a Telegram Bot that send audio phrases. It's intended for being part of a group.
There are 2 operating modes: you can request a phrase using /say
and the bot can send by himself a phrase when a mention
word appear on the sentences of other users. In this case, it will send a phrase taking into account the words in that sentence.
Currently, it supports this commands:
/say [ID]
: send the phrase with that id. If not id is provided it will pick a random one/list
: list all the phrases/top
: most popular phrases
Also, the bot will read all the messages sent to a group and if any of the words are in the mention words
list, it will send a phrase related to the words in that sentence. If there are any word in the sentence that appears
in the keywords of the phrases it will pick one of these. In other case, it will pick a random phrase.
The description file describes the dataset and the audio phrases.
path
: the folder where are the files.mention_words
: the words to which will respond and will send a phrasedata
: the audio phrases. The key is the name of the audio file.title
: title of the phrasekeywords
: keywords used to select phrase candidates to respond a mention
The first step is to create a bot using BotFather.
Then, disable privacy mode (to work looking for mention words) with /setprivacy
command.
Finally, copy the given token to config.py
.
Now we need to create the phrase dataset:
- Put all your audio files in a folder, default folder is
data/
. Files must be.ogg
extension (you can use http://media.io/ to convert them) - (Optional) Run script
script_utils/rename_files.py
with the dataset folder as argument to rename files. - Run script
script_utils/create_description_file.py
with the dataset folder as argument. It will create in the same directory the description file template describing the dataset. Put the path of the description file inconfig.py
- Complete the information in the description file.
- Start the bot and enjoy. ;)