本文介绍了提供的频道必须是语音频道.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")

这是我的代码,但是当我尝试移动用户时,它给了我错误提供的频道必须是语音频道".

This is my code but I when I try to move the user it gives me the error "The channel provided must be a voice channel."

我知道机器人可以正常工作,因为我之前有一些简单的命令可以更早地回复消息并且它们运行良好.

I know the bot works because I had some simple commands earlier that would reply to messages earlier and they worked fine.

我是 python 和不和谐机器人的新手,所以我真的不知道该怎么做.任何帮助表示赞赏.

I am new to python and discord bots so I don't really know what to do. Any help is appreciated.

推荐答案

move_member 的通道参数必须是一个Channel 对象,而不仅仅是通道ID.这在 move_member

The channel argument to move_member must be a Channel object, not just the channel id. This is noted in the documentation for move_member

您不能传入 Object 而不是 Channel 此函数中的对象.

@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")

这篇关于提供的频道必须是语音频道.move_member 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:20