提供的通道必须是语音通道。 move_member 错误
The channel provided must be a voice channel. error with move_member
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import time
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_ready():
print ("Ready")
@bot.command(pass_context=True)
async def Move(ctx):
#channel to move to '414543063575429131'
#user to move '192361974053470208'
await bot.move_member('192361974053470208', '414543063575429131')
print("done")
bot.run("token_here")
这是我的代码,但是当我尝试移动用户时,它给我错误 "The channel provided must be a voice channel."
我知道该机器人可以正常工作,因为我之前有一些简单的命令可以更早地回复消息并且它们运行良好。
我是 python 和 discord 机器人的新手,所以我真的不知道该怎么做。感谢任何帮助。
move_member
的频道参数必须是 Channel
对象,而不仅仅是频道 ID。 documentation for move_member
中注明了这一点
You cannot pass in a Object
instead of a Channel
object in this function.
@bot.command(pass_context=True)
async def move(ctx):
destination = '414543063575429131'
user = '192361974053470208'
await bot.move_member(ctx.message.server.get_member(user), bot.get_channel(destination))
# The get_member doesn't look to be strictly necessary, but it doesn't hurt
# and improves readability
print("done")
import discord
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import time
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_ready():
print ("Ready")
@bot.command(pass_context=True)
async def Move(ctx):
#channel to move to '414543063575429131'
#user to move '192361974053470208'
await bot.move_member('192361974053470208', '414543063575429131')
print("done")
bot.run("token_here")
这是我的代码,但是当我尝试移动用户时,它给我错误 "The channel provided must be a voice channel."
我知道该机器人可以正常工作,因为我之前有一些简单的命令可以更早地回复消息并且它们运行良好。
我是 python 和 discord 机器人的新手,所以我真的不知道该怎么做。感谢任何帮助。
move_member
的频道参数必须是 Channel
对象,而不仅仅是频道 ID。 documentation for move_member
You cannot pass in a
Object
instead of aChannel
object in this function.
@bot.command(pass_context=True)
async def move(ctx):
destination = '414543063575429131'
user = '192361974053470208'
await bot.move_member(ctx.message.server.get_member(user), bot.get_channel(destination))
# The get_member doesn't look to be strictly necessary, but it doesn't hurt
# and improves readability
print("done")