K
K
Killir Vanya2292021-06-22 12:08:15
Python
Killir Vanya229, 2021-06-22 12:08:15

When a participant is mentioned in the !vmute command, if he is in the voice channel of the discord, he should be transferred to another channel, how to do this?

My code:

@commands.command(aliases=['Vmute', 'вмут', 'Вмут', 'vmut', 'вмуте', 'вЗамутить', 'взамутить', 'вМутить', 'вмутить'])
    @commands.has_permissions(kick_members = True)
    async def vmute(self,ctx, member: discord.Member, duration = None, *, reason = None, channel='id=︱Loading...'):
        channel = discord.utils.get(ctx.message.guild.voice_channels, name='︱Loading...')
        mute_role3 = discord.utils.get(ctx.message.guild.roles, id = 847783493160796181)
        if ctx.member in ctx.guild.voice.channel:
            await member.move_to(channel)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Krytiu_govnocoder, 2021-06-23
@Krytiu_govnocoder

channel = discord.utils.get(_ctx.message.guild.voice_channels, id = id)
for i in ctx.guild.voicechannels:
await member.moveto(channel)⁣
Well like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question