Issue
I’m trying to create a music bot for discord and I finish the code and tried to run it and when I run the play command it simply says this.
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "play" is not found
Here’s my code.
import discord
from discord.ext import commands
import youtube_dl
TOKEN = "Token here"
bot = discord.ext.commands.Bot(command_prefix = "s ");
@bot.event
async def on_ready():
channel = discord.utils.get(bot.get_all_channels(), id=794444804607574026)
await channel.connect()
async def play(ctx, url):
player = await voice_client.create_ytdl_player(url)
player.start()
bot.run(TOKEN)
Solution
You haven’t added @bot.command(name="play")
above the play function
import discord
from discord.ext import commands
import youtube_dl
TOKEN = "Token here"
bot = discord.ext.commands.Bot(command_prefix = "s ");
@bot.event
async def on_ready():
channel = discord.utils.get(bot.get_all_channels(), id=794444804607574026)
await channel.connect()
@bot.command(name="play")
async def play(ctx, url):
player = await voice_client.create_ytdl_player(url)
player.start()
bot.run(TOKEN)
Answered By – Abhay Malik
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0