moonstar-x / discord-tts-bot

A Text-to-Speech bot for Discord.
https://docs.moonstar-x.dev/discord-tts-bot
MIT License
98 stars 84 forks source link

Bot only works if spawned using the say command but not with aeiou. #34

Closed moonstar-x closed 3 years ago

moonstar-x commented 3 years ago

:bug: Describe the Bug

If the bot is not in a channel prior and aeiou command is used, the bot join but will not send any TTS, even if say command is used. Once this happens, the console log displays a 400 request error.

The bot only works if spawned using the say command. Any aeiou command will only work if the bot was already in a channel.

:pencil2: Steps to Reproduce

  1. The bot is not connected to voice.
  2. Run aeiou command
  3. Bot joins but is stuck in an unexpected state

:confused: Expected Behavior

The bot should be able to send TTS even if spawned using aeiou.

:scroll: Log

Mar 12 20:42:41 moonstar-server npm[29941]: (8:42:41 PM) - [INFO] -  User yoo who did dis 😂😂 issued command aeiou in Greencoast Gaming.
Mar 12 20:42:42 moonstar-server npm[29941]: (8:42:42 PM) - [INFO] -  Joined 🦇 LA BATICUEVA 🦇 in Greencoast Gaming.
Mar 12 20:42:42 moonstar-server npm[29941]: (8:42:42 PM) - [ERROR] -  Request failed with status code 400

:question: Other Information

moonstar-x commented 3 years ago

Fixed in #39.

haloflooder commented 3 years ago

Fixed in #39.

Didn't want to create a new issue but it seems like this problem still exists.

I'm hosting the bot via docker with docker-compose and when you use "aeiou", it does nothing. Then when you try to use "say", the bot no longer says anything.

moonstar-x commented 3 years ago

Have you tried updating your container to the latest image?

I haven't had this issue in a really long time and I've been hosting the bot for over 200 servers. Do you get a 400 error code as well?

haloflooder commented 3 years ago

I put it up a fresh instance 2 days ago but just pulled the latest image right now just in case. Seems like the problem still exists on my side and not sure what could be causing it. Going to try hosting it somewhere else to see if it's somehow an issue with the connection on the current host I'm using.

I don't get any 400 error code in console or dm's.

I also discovered that instead of just restarting the docker container to get it unstuck, you can just use the stop command then use say afterwards. After the aeiou clip plays nothing (it shows "Playing aeiou for " in console), the bot doesn't play any other clips from say or aeiou.

console logs

Just for reference, this is the docker compose I'm using in case you wanted to see it

version: "3.2"

services:
  obbytts:
    image: moonstarx/discord-tts-bot
    restart: always
    environment:
      DISCORD_TOKEN: "<redacted>"
      DISCORD_PREFIX: "."
      DISCORD_OWNER_ID: 136676457987571713
moonstar-x commented 3 years ago

Hmmm, this is weird, it doesn't seem like it's related to the initial problem from this issue.

This kinda looks like aeiou doesn't work altogether for you, not that using aeiou first (making the bot join the channel with aeiou) would break subsequent requests.

It could certainly be the host you're using that cannot connect to the url from where the aeiou tts is being pulled.

Are you hosting on firebase / google cloud platform by any chance?

haloflooder commented 3 years ago

Yeah, doesn't matter if the bot was summoned with say or aeiou. Just doesn't work overall for some reason and makes the bot stuck after using aeiou.

I currently have the bot hosted on a VPS at OVH (4 vcore, 8gb ram, gigabit). I will see if I'll have better luck at my homelab. Funny thing is, I am also having an ongoing unrelated problem recently with other discord bots I'm hosting. Haven't seen this issue before at this host but it takes 5 seconds to react/respond to the discord api which is odd but don't think that would affect the tts bot unless you think it would.

When I get around to it, I will try running the bot in my homelab.

Btw, should I just make a new issue since it's not related to the 400 request error or is it fine to stick to this issue?

moonstar-x commented 3 years ago

I think it would be best if you created a new issue just so that the conversation stays relevant there, as long as you feel as the issue is really related to the project because so far it sounds like it's an issue with your VPS.

I've never used OVH before for VPSs so I wouldn't be able to give you an honest opinion on them. However, I suspect that it must be an issue on the OVH side since you mention you're having latency issues to the discord API on other bots.

It somewhat sounds like outgoing connections are being throttled by either something in your VPS or by OVH themselves because if you're having trouble with small payloads (like reacting...), sending voice packets will surely be affected.

In any case, try it in your homelab to see if it works, if it does then you can assume that the problem lies in your VPS. Maybe even try deploying a new VPS instance to see if it's a config issue or something?