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

Per-channel TTS #54

Closed 4P5 closed 2 years ago

4P5 commented 2 years ago

:zap: Describe the New Feature

Add an option to the config to specify a channel to use without a prefix. Any messages sent in that channel will be read out loud. Maybe a list of channels and their respective voices/TTS engines, so we can have a #john-madden for all our aeiou needs, and a #no-mic-chat channel that reads aloud people's messages?

moonstar-x commented 2 years ago

Hi there!

I don't think this would be possible, at least not the no prefix part.

The next update for this bot will change the current commands into slash commands because in the 2022, Discord will not allow bots to read messages (unless you apply to get this restriction taken out if your bot is in over 100 servers). Instead bots will need to use the slash commands interactions in order to actually run commands from users.

4P5 commented 2 years ago

Ah, that's a shame. It's not too big of a deal but it does get slightly tedious to type the prefix (I've made mine ;; for TTS) every time. Does the change affect bots with under 100 servers (i.e., one server)?

moonstar-x commented 2 years ago

Let me analyze this a bit more, because I don't dislike the idea and actually, plenty of people have asked me for a way to remove the prefix.

I suppose I could work on it, obviously it wouldn't work for bots in over 100 servers since an application is required. I believe that for bots in under 100 servers, this application is actually not necessary.

In any case I'm going to leave this open, I still need to work on the slash commands update for the library before working on this.

LackyPal commented 2 years ago

add something like the following on messageCreate event

const ttsChannels = []; // an array of channels ids
if (ttsChannels.include(message.guild.id)) {
  const ttsCmd = client.commands.get("say");
  const content = message.content;
  await ttsCmd.run(message, content);
}

advance this method, by adding guild specific channels;

moonstar-x commented 2 years ago

Hi there, thanks for the suggestion.

I'm not worried about the implementation for this really, it's more related to the message intent privilege that bots in more than 100 servers will need.

I'm not too sure how many of the project's users are running popular bots, but the one I'm hosting is actually in over 300 servers so obviouly no chance this would work on my instance.

It is also because of the changes that Discord is making to their bot systems, they want all bots to work the same way in an easily documentable way, this is why slash commands exist. They want bot developers to use them for command interactions to normalize how bots work across all servers.

moonstar-x commented 2 years ago

Hey there, I have currently started an update for the bot.

I'm still a bit concerned about this feature request. I'm currently turning all commands into slash commands because that is the new standard for bots on Discord. Something like this kinda goes against the whole concept.

As of right now, one of the features I am currently working on is for #56 which would allow users to set their own default voices and TTS provider, so that any time they run the say command, the bot knows what settings to choose. I feel like this may be the closest thing.

Let me know what you think.

4P5 commented 2 years ago

Hi! From what I can tell the problem lies with self-hosted bots, right? Maybe include an "experimental" option for this feature in the config, but let people know that they have to apply for servers over 100 users?

For me, the best solution is the one that takes the least effort to use. Making my command ;; works pretty well currently, and I can edit the new system to be /; or // or something, but it'd still be amazing to just type a message normally and have it read aloud!

I'm pretty new to Javascript but if you could point me in the general direction of where to get started with this, I'd be super grateful! (That is if it isn't a feasible option to add.)

Thanks for making this project regardless, it's extremely useful and I've had fun editing bits to do different stuff.

moonstar-x commented 2 years ago

Ok, I'll work on this.

Currently, how this would work is:

(Right now I'm updating the command structure and it may look a bit more complicated now but it's somewhat necessary because I'm planning on supporting more TTS providers.)

Once those commands have been set, anyone can type something in that channel and the bot would play the TTS messages just as if you were using the say command but without actually specifying the command.

I hope to release these changes sometime during this week.

moonstar-x commented 2 years ago

Added in #58.