GithubHelp home page GithubHelp logo

connectionmaster / python_telegram_tts_bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kaltakhchyand/python_telegram_tts_bot

1.0 0.0 0.0 4.16 MB

Python telegram bot to test Yandex TTS

License: MIT License

Python 100.00%

python_telegram_tts_bot's Introduction

python_telegram_tts_bot

Telegram bot that does TTS & STT via Yandex SpeechKit on python

Build Status Maintainability Test Coverage Documentation Status

With this bot written on python3 with python-telegram-bot (https://github.com/python-telegram-bot/python-telegram-bot), you can create a bot that converts text message from a user into an audio file and voice message into text.

Take into consideration that it's my pet project.

Before installation

Bot requires python 3.6+ You have to register your bot at BotFather and create Yandex Cloud account. More on that down below Also you need to obtain 4 tokens:

This bot uses this tokens as env variables - you should export them locally by yourself with these exact names:

 export API_KEY_BOT=...
 export IAM_TOKEN=...
 export FOLDER_ID=...
 export OauthToken=...

As you may see IAM token works only for 12 hours. This bot will update it automatically so you don't have to worry about it.

Installation

OS X & Linux:

Clone this repo

 git clone 

Install sox and ffmpeg. Sox is used to split audio on silence, ffmpeg - for audio files conversion.

For Linux:

sudo apt-get install -y sox ffmpeg

For OS X:

brew install sox ffmpeg

Create virtual env and install dependencies

python3 -m venv env
./env/bin/activate
pip install -r requirements.txt

Setup required env vars as it was mentioned erlier

Run it

python bot.py

Usage example

There are 4 modules:

  • bot.py - this is top module
  • handlers.py - contains handlers and conversation for python-telegram-bot dispatcher
  • yandex_tts(need to rename) - helds funcs to work with Yandex API
  • check_wav_length(definitely need to rename) - contains functions to work with audio files

So if you want to change and customize something - go there and change stuff.

P.S. Also I've made readthedocs documentation(https://python-telegram-tts-bot.readthedocs.io/en/latest/index.html) but probably I won't support it(I've made it just to test Sphinx and RST)

Contributing

  1. Fork it (https://github.com/KaltakhchyanD/python_telegram_tts_bot/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

python_telegram_tts_bot's People

Contributors

kaltakhchyand avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.