Skip to content

Extensible multi-language Discord voice bot

License

Notifications You must be signed in to change notification settings

knt2nd/knt2-dbot

Repository files navigation

Kanata 2nd Discord Bot

Extensible multi-language Discord voice bot

Demo Movie (Developer's Tweet)

Features

  • Google Cloud Text-to-Speech, 220+ voices, 40+ languages
  • Smart speaker-ish chat command, "OKanata, change my voice"
  • Command restriction by access control list
  • Multi-server configuration
  • Extensible plugin system to easily develop in multiple languages
  • Builtin plugins support English, Japanese 日本語, Simplified Chinese 简体中文, and Traditional Chinese 繁體中文

Builtin plugin features

Name Description
voice Voice changer
read User dictionary, format, etc
res Auto reply, reaction
vc Auto join, leave, etc
config Online configuration
gctts Switch TTS to Google Cloud TTS
firestore Switch datastore to Firestore
help Help command
system System commands

Requirements

Prepare Discord bot

  1. Go to Discord Developer Portal
  2. Click the New Application button
  3. Input a bot name as you want and Create
  4. Go to the Bot page, and click the Add Bot button
  5. Click "Yes, do it!"
  6. Click the Copy button to get your bot token (and set to your env.yml later)
  7. Disable the PUBLIC BOT option unless you want to make it public
  8. Go to the OAuth2 page, and check the bot option, and click the Copy button to copy URL
  9. Paste to your browser address bar and go to there
  10. Select the server you want to invite, and click the Authorize button

Prepare Google Cloud TTS

Follow the official document instructions. You don't have to set the environment though. All you need to do is create a JSON file. Then place the file as credential.json in this project.

Note: Google Cloud TTS is not free but almost free. You don't have to worry about payment when your bot is private. cf. Pricing

Environment

Copy example-env/[lang].[type].yml as env.yml and set your own ENV.

  • [lang].private.yml is a private bot template
    • Server admins are trustable
    • Server users are mostly trustable
  • [lang].public.yml is a public bot template
    • Even server admins are not trustable
    • Server users are possibly malicious

Permissions

Basically, the bot requires the following permissions.

  • Text Channel
    • Send Messages
    • Embed Links
    • Attach Files
    • Add Reactions
    • Manage Messages
    • Read Message History
  • Voice Channel
    • Connect
    • Speak

Install and lunch

npm run init
npm start

Development

npm run dev     # Launch with development ENV
npm run lint    # Lint codes
npm run beatify # Beatify codes

Plugin install

cd plugins
git clone __PLUGIN_REPO__
cd ..
npm run init

Plugin development

Copy example-plugin as plugins/example and run npm run init and see the example codes.

References

License

MIT

About author

Name: Kanata
Language: Japanese(native) English(intermediate) Chinese(basic)
Discord: Kanata#3360
Twitter: https://twitter.com/knt2nd
GitHub: https://github.com/knt2nd

About

Extensible multi-language Discord voice bot

Resources

License

Stars

Watchers

Forks

Packages

No packages published