Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make a discord python bot recognize when a person in a voice channel talks?

I am currently creating a Discord Python bot and I would like the bot to be able to recognize when people in a voice channel are speaking. The bot does not have to be able to recognize speech.

For example, if a member speaks, I want the bot to do an action, such as play audio.

Let me know if you could help or have done something similar. Also, if anyone knows anything about recognizing speech or monitoring the loudness of someone's audio, let me know!

like image 392
spencer Avatar asked Apr 25 '21 02:04

spencer


People also ask

How do you know if someone is in a voice channel on Discord?

Head to your favorite Discord server and find a voice channel indicated by the small speaker icon. Here's an example from @thesteemengine server: Once you've joined, your username will appear below the voice server in a list of other attendees who are present in the voice server.

How do you make a Discord bot talk in the voice channel?

Open Discord and send a voice message in any channel you want. Type “/tts” followed by a space, and then type your message. Send the message. The slash command will not appear anymore in your message, but all the users will hear your message aloud in the channel you have sent a message by a voice bot.

Can Discord bot listen to voice?

In addition to sending audio over voice connections, you can also receive audio (i.e., listen to other users and bots in a voice channel) using discord.


1 Answers

Discord.py does not support voice yet, You can use Discord.js for now. I ran into the same problem and had to move to @discordjs/opus or opusscript both have voice support...

EDIT

You can either follow my path (changing the whole language and library) OR Use this:

what I found discord.py[VOICE] which uses PyNaCl (for voice support)

python3 -m pip install -U discord.py[voice]

To install the version that supports voice uses PyNaCl as extra package than discord.py for more details and more documentation about this please check this

like image 60
Mbistami Avatar answered Sep 22 '22 12:09

Mbistami