With my bot, I am trying to make it so that when a person gets the 'Prisoner' role, the bot automatically moves them into the 'jail' voice channel if they are already in a voice channel. I have tried lots of solutions from other stackoverflow threads, github threads and the documentation but none of them work.
class Jail(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def jail(self, ctx, person: discord.Member):
try:
jailor = discord.utils.find(lambda r: r.name == 'Jailor', ctx.message.guild.roles)
if jailor in ctx.author.roles:
prisoner = discord.utils.find(lambda r: r.name == 'Prisoner', ctx.message.guild.roles)
await person.add_roles(prisoner)
jail_vc = self.bot.get_channel('jail')
await person.move_member(jail_vc)
else:
await ctx.send("You need to have the Jailor role to use this command")
except Exception as e:
print(str(e))
That code returns: 'Member object has no attribute 'move_member' Other things I have tried:
- await
self.bot.move_member(person, jail_vc) - await
commands.move_member(person, jail_vc) - await
command.move_member(person, jail_vc) - await
ctx.guild.move_member(person, jail_vc)
And some other variations. The error is always 'something' has no attribute 'move_member' I am using the rewrite branch. How can I implement moving a person from any voice channel into the specific voice channel 'jail'? Any help will be greatly appreciated :).
move_membermethod? Did the stackoverflow threads show code that saysmove_memberin it? What did they say? What solutions did you try? - Karl Knechtelmove_memberand alot of them were also for the old branch of discord.py. - BobDigby