Skip to content

larskarbo/ankibot

Repository files navigation

AnkiBot

Telegram Bot for Anki Sound Recording


Github open issues Bitbucket open issues GitHub contributors David Generic badge

Features

  • Ease-of-use. The Telegram makes it is easy to record sounds on any platform.
  • Perfect for outsourcing. No need to split mp3s and work with audio manually. Just point your coach to the bot!
  • Flexible api. Define which notes you want to have recorded in noteSpec.js. Specify field, deck and card type.
  • MP3s. Converts all sound files to mp3 so cards run on any platform.
  • Multi-note smartness. If you have the same word/sentence to be recorder on multiple notes, it will automatically add the sound to all notes.
  • Performance. Asynchronous network actions means you will never be waiting for the database.
  • Secure. Periodically checks if sounds are being recorded properly and saved to the Anki DB.
  • Retry possibility. Listen to your recording and do another recording right away if you are not satisfied.
  • Any language or learning material. Ankibot is not tied up to a specific language or subject! Use it for whatever you need sounds for.
  • Access control. To prevent abuse, you can specify which chat-ids you want to have access.
  • Emojis. 🎤🌈

⚠️ NB: You will need to create your own new bot user on Telegram and host it on your. This is because Anki does not yet have an official public API.

Installation

You will need:

When you have these ↑, clone the repo and run this command:

Install dependencies:

yarn install

Remember to also set the ANKIBOT_API_TOKEN environment variable to your bot token API.

Configure noteSpecs - noteSpecs.config.js

In the noteSpecs.config.js file you can specify which notes you want sounds for and how ankibot should work with them.

You can add multiple noteSpecs.

This is the format:

const noteSpec = {
  deck: 'french', // Which decks do you want to search?
  cardType: '2. Picture Words', // Which card types do you want to add sounds to?
  textField: 'Word', // Which field in the note contains the _text to record_?
  soundField: 'Pronunciation', // Which field in the note will contain the pronounciation file?
}

Add the noteSpecs to the noteSpecs.config.js file like this:

module.exports = [noteSpec1, noteSpec2]

Running the bot

From your computer, run:

yarn start

In Telegram, message the bot:

/start

Bot API

/start

Starts a recording session and gives you the first word.

/notifyall

Notifies all registered users of the app that the app is online and ready for recording.

/sync

Syncs Anki with AnkiWeb

Access control

ANKIBOT_ALLOWED_IDS

By default, all chat-ids are accepted. If you add chat-ids to the env variable ANKIBOT_ALLOWED_IDS access control is on.

Format (delimited by comma): ANKIBOT_ALLOWED_IDS=12341234,23452345,34563456

Related

  • Anki - Spaced Repetition Software
  • AnkiConnect - Well-made API plugin for Anki

Thanks to FooSoft for creating AnkiConnect!

About

Telegram Bot for Anki Sound Recording

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published