0 votes
in Programming by (400 points)

i want to make a small bot like google assistant. It can connect to a voicechannel and play some audio. But thats only a music-bot, I want to record the audio to analyse it and (because the bot is on a RaspberryPi) turn an LED on or off depending on what I said in the voice channel. My current solution requieres only one command and its only that i understand it. I found a way to record (https://github.com/Sheepposu/discord.py/blob/master/examples/receive_vc_audio.py), but i get following error: AttributeError: 'VoiceClient' object has no attribute 'start_recording' Heres my code:

import discord
from discord.ext import commands
import time
import asyncio
import rgb #my own rgb-led-thing

def led(stat):
    if stat == "on":
    if stat == "off":

class add(commands.Cog):
    def __init__(self, client):
        self.client = client

    async def test(self, ctx):
        if not ctx.message.author.voice:
            # Exiting if the user is not in a voice channel
            return await ctx.send('Youre not in a vc')

        channel = ctx.author.voice.channel
        vc = await channel.connect()

        vc.start_recording(self.on_stopped, msg.channel)

        vc.play(discord.FFmpegPCMAudio("rickroll.mp3")) #this is from my old version of this cog but i left it here for testing because if it doesnt plays i know smth is wrong
        await asyncio.sleep(19) #exactly the duration of the song


        await ctx.send("**TEST TEST TEST TEST TEST**")
        await ctx.voice_client.disconnect()

def setup(dc):

Please log in or register to answer this question.