here my code with imports tnx for advice
for sure line 32 is the key point but i dont know what to do there
import speech_recognition as sr import pyaudio import playsound import os import time from gtts import gTTS from selenium import webdriver from getpass import getpass from pynput.keyboard import Key, Controller def speak(text): tts = gTTS(text=text, lang="en") filename = "voice.mp3" tts.save(filename) playsound.playsound(filename) def get_audio(): r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source) said = "" try: said = r.recognize_google(audio) print(said) except Exception as e: print("Expection:" + str(e)) return said text = get_audio() if "DC" in text: print("https://discord.gg/RjnpzX3") if "how are you" in text: speak("I am fine ")
for sure line 32 is the key point but i dont know what to do there
except Exception as e: print("Expection:" + str(e))