text: import discord
  from discord.ext import commands
  from discord.utils import get
  import os
  # import requests
  # import json
  # import random
  # from replit import db
  # from keep_alive import keep_alive
  # import youtube_dl
  # import pafy # pip install ffmpeg-python
  # import nacl # pip install PyNaCl
  
  client = discord.Client()
  client = commands.Bot(command_prefix = '.')
  
  print(client)
  
  # if "responding" not in db.keys():
  #     db["responding"] = True
  
  @client.event
  async def on_ready():
      print("Bot online.")
  
  @client.command(pass_context = True, aliases = ['p'])
  async def play(ctx, url: str):
    channel = ctx.message.author.voice.channel
    voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
    
    if voice and voice.is_connected():
        await voice.move_to(channel)
    else:
      voice = await channel.connect()
      print(f"The bot has connected to {channel}\n")
    
    song_there = os.path.isfile("song.mp3")
  
    try:
      if song_there:
        os.remove("song.mp3")
    except PermissionError:
      await ctx.send("Wait for current song to end, or use the 'stop' command.")
  
    ydl_opts = {
      'format': 'bestaudio/best',
      'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192'
      }]
    }
  
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      ydl.download([url])
    for file in os.listdir("./"):
      if file.endswith(".mp3"):
        os.rename(file, "song.mp3")
    voice.play(discord.FFmpegPCMAudio("song.mp3"))
  
  @client.command(pass_context = True, aliases = ['l'])
  async def leave(ctx):
      channel = ctx.message.author.voice.channel
      voice = get(client.voice_clients, guild=ctx.guild)
  
      if voice and voice.is_connected():
          await voice.disconnect()
          print(f"The bot has left {channel}")
          await ctx.send("Later dudes!")
      else:
          print(f"Not in voice channel.")
          await ctx.send("I'm not in a voice channel.")
  
  @client.command(pass_context = True, aliases = ['s'])
  async def pause(ctx):
    voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
    if voice.is_playing():
      voice.pause()
    else:
      await ctx.send("No audio is playing")
  
  @client.command(pass_context = True, aliases = ['r'])
  async def resume(ctx):
    if voice.is_paused():
      voice.resume()
    else:
      await ctx.send("The audio is not paused.")
  
  @client.command(pass_context = True, aliases = ['q', 'n'])
  async def queue(ctx, url: str):
    channel = ctx.message.author.voice.channel
    voice = get(client.voice_clients, guild=ctx.guild)
    song_there = os.path.isfile("next_song.mp3")
  
    try:
      if song_there:
        os.remove("next_song.mp3")
    except PermissionError:
      pass
  
    ydl_opts = {
      'format': 'bestaudio/best',
      'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192'
      }]
    }
  
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
      ydl.download([url])
    for file in os.listdir("./"):
      if file.endswith(".mp3") and not file.startswith("song"):
        os.rename(file, "next_song.mp3")
        print("song added")
  
    song_file = file("song.mp3")
    del song_file
  
  
  keep_alive()
  client.run(os.getenv('TOKEN'))
  