我正在尝试为不和谐创建一个音乐机器人,我完成了代码并尝试运行它,当我运行播放命令时,它只是说这个。
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "play" is not found
这是我的代码。
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)
答案 0 :(得分:1)
您尚未在播放功能上方添加@Html.DropDownListFor(n=> n.LevelTwo, new List<SelectListItem> { new SelectListItem{ Text= "My selected value", Value= "My selected value" }}, new { @class = "custom-select" })
@bot.command(name="play")
答案 1 :(得分:0)
之前
A2
之后
async def play(ctx, url):
player = await voice_client.create_ytdl_player(url)
player.start()
答案 2 :(得分:0)
只需使用此代码:
main.py
from discord.ext import commands
from discord.ext.commands import bot
import discord
import os
import youtube_dl
bot = commands.Bot(command_prefix="s")
@bot.event
async def on_ready()
print("{0.user} is online".format(bot))
@bot.command()
async def play(ctx, url):
player = await voice_client.create_ytdl_player(url)
player.start()
.env
TOKEN=<paste your token here>
希望对你有帮助(: