Giter Site home page Giter Site logo

wotschofsky / discord-live-translator Goto Github PK

View Code? Open in Web Editor NEW
63.0 4.0 13.0 833 KB

Voice Translation Bot for Discord

Home Page: https://livetranslator.xyz

License: GNU Affero General Public License v3.0

JavaScript 1.26% Dockerfile 8.40% TypeScript 79.30% Python 2.77% Shell 0.20% Rust 8.07%
bot discord-bot translation voice-chat speech discord

discord-live-translator's Introduction

NOW AVAILABLE AS FREE HOSTED BOT 🎉

Discord Live Translation Bot

This is the documentation for the re-written v2 version. Original v1 Version

A bot that automatically translate voice chat into a user selectable language in order to provide an easy way to communicate through voice chat for individuals speaking different languages natively. This project was originally started during the 2019 Discord Hack Week hackathon.

How to use

  1. Join a voice channel
  2. Make the bot join your channel by typing /join
  3. Use /start <target> to select the target language and start the translation for yourself
  4. Just talk like normal
  5. Once you're done end your session using /stop and make the bot leave your channel using /leave

Other commands: /status tells you if you have translation mode enabled. /languages shows you all available languages.

Setup using Docker

If you for whatever reason don't want to use the free hosted version of this bot is the easiest way to host this bot yourself is using Docker. You can get the required credentials from the Discord Developer Portal.

  1. Clone the repo
  2. Configure a .env file with appropriate values for BOT_TOKEN and CLIENT_ID
  3. Run docker compose -f docker-compose.prod.yml up -d

Deploying slash commands

For the bot to be controllable, you need to deploy the included slash commands.

Run docker exec discord-live-translator-bot-1 pnpm run deploy on your server after the bot container has started.

Alternatively run pnpm run deploy in your local environment.

When setting GUILD_ID in addition to the variables above, commands will be automatically redeployed on bot startup for that specific guild/server.

discord-live-translator's People

Contributors

dependabot[bot] avatar wotschofsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

discord-live-translator's Issues

Docker Error

When i start docker i have this error is normal:
image

Does not work.

I have server permissions. I invited it to the server. Me and a friend who speaks spanish joined a voice call. I invited the bot.

Typed "!translation join" and then "!translation en es". It joined the call, did a sound effect, but didn't work after that. Does it only translate text?

Bot is offline

As the title says, it is offline, more I can't make of it, it just doesn't react to commands and is shows offline
Thanks in advance if this gets fixed

problems with setting up Docker

Tried to setup Docker and host it myself as you suggested, the docker engine is running fine
the command you shared didn't work, can you help me with this? thanks
image

Also can you provide an example for the .env file?

HOW TO INSTALL?

I'm dumb, how do I instlall this?

Is it client sided bot or bot on a server?

Not working, dead silent

So i ran all the commands as stated except pnpm run deploy
Bot joins the voice chat i input the start command and choose my target language and after that bot is dead silent
Help

.env: The system cannot find the file specified

Clony the repository.
I used the terminal to specify the path to the folder:
cd C:\Users\c920\discord-live-translator-main.

In the path:
discord-live-translator-main\src.
I've customized the env.ts file.

import { createEnv } from '@t3-oss/env-core';
import dotenv from 'dotenv';
import { z } from 'zod';

dotenv.config();

const env = createEnv({
  clientPrefix: 'PUBLIC_',
  client: {},
  server: {
    BOT_TOKEN: z.string(********),
    CLIENT_ID: z.string(***********).optional(),
    GUILD_ID: z.string().optional(),
    LOG_PATH: z.string().optional(),
    REDIS_URL: z.string().optional(),
    STT_HOST: z.string(),
    TRANSLATION_HOST: z.string()
  },
  runtimeEnv: process.env
});
export default env;

I run the bot and get an error

C:\Users\c920\discord-live-translator-main> docker compose -f docker-compose.prod.yml up -d
Failed to load C:\Users\c920\discord-live-translator-main.env: open C:\Users\c920\discord-live-translator-main.env: The system cannot find the file specified.

Please help solve the problem

I know this issue is very vague but it appears to have stopped working?

Invited it into a server with some spanish friends and ran /join. The bot joined (and made the join noise), but after running the start command (in this case /start spanish english) nothing happened. Tried enunciating and different languages but no output. Can provide more details if needed :)

 ERR_PNPM_CANNOT_DEPLOY

same issue as i opened few weeks ago

user:/home/user/discord-live-translator# docker exec discord-live-translator-bot-1 pnpm run deploy
OCI runtime exec failed: exec failed: unable to start container process: exec: "pnpm": executable file not found in $PATH: unknown
user:/home/user/discord-live-translator# pnpm deploy
 ERR_PNPM_CANNOT_DEPLOY  A deploy is only possible from inside a workspace

No slash commands when self-hosting

I decided to try to self-host the bot with docker, following the instructions. The bot shows as Online and I was able to add it to my server, but there are no slash commands for the bot. Is there something I need to do that isn't listed in the instructions to get slash commands to work?

bot is offline

hi! the bot went offline and does not respond to any commands.

is it working?

last time i tried the live translation bot the /start command was not working.
I'm not sure if its been fixed since then

Bot does not work

After using /join, it joins and plays its normal starting sound, often also laggy. After using /start it starts to translate, you can hear or more guess that it translates the words we said, but it's very laggy, and you can't really understand it. We also tried different languages and inviting it again, but nothing seems to fix the problem.

Add support for other languages

Requesting support for Portuguese in particular. Otherwise exposing the other optional languages supported by LibreTranslate in the hosted, non-docker version would be helpful

Instructions unclear for how to join channel

I'm trying to set up the bot on one of my servers, and I'm following the readme instructions. It says to type !translation join into the voice channel, but there is nowhere to input bot commands in the voice channel. Is there another way to do this? Also, I would like to have different language streams available for the most common languages. Could I create additional channels for each language and connect it to the call channel?

Unable to command the bot to join any of my voice channels.

Hello. I might be using the bit wrong or fail to do something in order to get the desired outcome. I have invited the bot to my discord server, and when I type /join I get an error message saying that the application didn't respond. What can I do to fix this issue?

ERR_PNPM_CANNOT_DEPLOY

user:/home/user/discord-live-translator# docker exec discord-live-translator-bot-1 pnpm deploy
OCI runtime exec failed: exec failed: unable to start container process: exec: "pnpm": executable file not found in $PATH: unknown
user:/home/user/discord-live-translator# pnpm deploy
 ERR_PNPM_CANNOT_DEPLOY  A deploy is only possible from inside a workspace

pnpm doesnt work like yarn please fix

bot offline

hi again! bot is offline, thank you in advance for fixing it. (:

Bot is Offline and dont answers Commands

Hey,

i have a problem with my Server. I created a new Server for Testing and Invited the Bot from the Website. The Bot is visible under users of the Server, but he is Offline. When i type commands like !translation join or other command he dont repley to the commands. I tried to add the nvo.io Text translate Bot and that is working and that answers in Text Channel.

Can someone help me pls?

Thanks!

Self-hosted bot crashes when analyzing recording (fetch to stt failed)

Hello there!

I'm attempting to get your creation up and running on a Debian 12.1 install as per instructions in README.md. The install is up to date and the box has plenty of free storage and memory as the problem I'm about to delve into occur. vm.overcommit_memory = 1 has also been set and verified as part of my blind stab at resolving this issue.

I've successfully managed to get the bot onto our server, commands are being recognized and all seems well up to this point. The bot acknowledges our desired language, joins the voice channel when requested and plays its little fanfare. :)

However, a few errors are thrown during startup.

ghcr.io/wotschofsky/discord-live-translator log:

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 172.18.0.3:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[ioredis] Unhandled error event: Error: connect ETIMEDOUT
    at Socket.<anonymous> (/app/node_modules/ioredis/built/Redis.js:170:41)
    at Object.onceWrapper (node:events:628:28)
    at Socket.emit (node:events:514:28)
    at Socket._onTimeout (node:net:571:8)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26)
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 172.18.0.3:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
yarn run v1.22.19
$ node -r source-map-support/register dist/app.js
[2023-08-30T00:42:41.681Z] Logged in as Super Secret Bot#1337!

Otherwise the logs look alright besides of redis lusting for a config.

Redis log:

1:C 30 Aug 2023 00:42:38.733 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 30 Aug 2023 00:42:38.733 * Redis version=7.2.0, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 30 Aug 2023 00:42:38.733 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 30 Aug 2023 00:42:38.733 * monotonic clock: POSIX clock_gettime
1:M 30 Aug 2023 00:42:38.733 * Running mode=standalone, port=6379.
1:M 30 Aug 2023 00:42:38.734 * Server initialized
1:M 30 Aug 2023 00:42:38.734 * Loading RDB produced by version 7.2.0
1:M 30 Aug 2023 00:42:38.734 * RDB age 28 seconds
1:M 30 Aug 2023 00:42:38.734 * RDB memory usage when created 0.85 Mb
1:M 30 Aug 2023 00:42:38.734 * Done loading RDB, keys loaded: 1, keys expired: 0.
1:M 30 Aug 2023 00:42:38.734 * DB loaded from disk: 0.000 seconds
1:M 30 Aug 2023 00:42:38.734 * Ready to accept connections tcp
1:M 30 Aug 2023 01:42:39.053 * 1 changes in 3600 seconds. Saving...
1:M 30 Aug 2023 01:42:39.053 * Background saving started by pid 14
14:C 30 Aug 2023 01:42:39.167 * DB saved on disk
14:C 30 Aug 2023 01:42:39.167 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
1:M 30 Aug 2023 01:42:39.254 * Background saving terminated with success

Libretranslate log:

Updating language models
Found 60 models
Keep 8 models
Downloading English → French (1.0) ...
Downloading English → German (1.0) ...
Downloading English → Italian (1.0) ...
Downloading English → Spanish (1.0) ...
Downloading French → English (1.0) ...
Downloading German → English (1.0) ...
Downloading Italian → English (1.0) ...
Downloading Spanish → English (1.0) ...
Loaded support for 5 languages (8 models total)!
Running on http://0.0.0.0:5000

ghcr.io/wotschofsky/discord-live-translator/stt log:

2023-08-30T00:42:38.659Z` INFO  [stt] Starting server at http://127.0.0.1:8000
2023-08-30T00:42:38.660Z INFO  [actix_server::builder] starting 1 workers
2023-08-30T00:42:38.660Z INFO  [actix_server::server] Actix runtime found; starting in Actix runtime
whisper_init_from_file_no_state: loading model from 'models/ggml-small.bin'
whisper_model_load: loading model
whisper_model_load: n_vocab       = 51865
whisper_model_load: n_audio_ctx   = 1500
whisper_model_load: n_audio_state = 768
whisper_model_load: n_audio_head  = 12
whisper_model_load: n_audio_layer = 12
whisper_model_load: n_text_ctx    = 448
whisper_model_load: n_text_state  = 768
whisper_model_load: n_text_head   = 12
whisper_model_load: n_text_layer  = 12
whisper_model_load: n_mels        = 80
whisper_model_load: ftype         = 1
whisper_model_load: qntvr         = 0
whisper_model_load: type          = 3
whisper_model_load: mem required  =  743.00 MB (+   16.00 MB per decoder)
whisper_model_load: adding 1608 extra tokens
2023-08-30T00:44:35.718Z INFO  [stt] Starting server at http://127.0.0.1:8000
2023-08-30T00:44:35.719Z INFO  [actix_server::builder] starting 1 workers
2023-08-30T00:44:35.719Z INFO  [actix_server::server] Actix runtime found; starting in Actix runtime

The problems begin as someone starts speaking. One can see in the logs that voice is being recorded, but the following error pops up in the ghcr.io/wotschofsky/discord-live-translator log:

[2023-08-30T00:44:31.969Z] Started recording 301695752688893952 to /app/cache/rec/301695752688893952_1693356271955.wav
[2023-08-30T00:44:32.332Z] Successfully finished recording 301695752688893952 to /app/cache/rec/301695752688893952_1693356271955.wav
[2023-08-30T00:44:32.333Z] Analyzing "/app/cache/rec/301695752688893952_1693356271955.wav"...
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11576:11)
    at recognizeRecording (/app/src/processors/recognizeRecording.ts:11:20)
    at _SpeakingMap.<anonymous> (/app/src/commands/join.ts:99:30)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any thoughts on what might be going on and how to resolve it? I'm a complete newbie to docker, so I figured before I poke at things further; I'd consult the oracles. :D

Best regards,
yours truely.

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.