Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.73k stars 3.74k forks source link

move_channel function not working #1381

Closed th3infinity closed 6 years ago

th3infinity commented 6 years ago

Hey, today i extended my bot to create channel and move members. But the function to move a channel doesnt do anything. I searched for it and added a sleep: await asyncio.sleep(1) but also doesnt work for already existing channels. The next i found was: pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice] but then the complete project wont work anymore. Is there any fix for this?

Code Snippet:

channel = await bot.create_channel(server,channel_name,(server.default_role, 
                 everyone),type=discord.ChannelType.voice)
await asyncio.sleep(1)
await bot.move_channel(channel, startposition + 1)

Thanks in advance

Harmon758 commented 6 years ago

I'm unable to reproduce this. What is startposition? Are you setting a proper position value that would move it in the channel list? See the documentation for Channel.position. Also note, the async branch of the library doesn't support channel categories, so you won't be able to move a text or voice channel into categories or between categories. At most, you'll be able to move them within categories or within the list of uncategorized channels. The asyncio.sleep is also unnecessary.

As for the rewrite branch, it has major breaking changes as it's a complete redesign of the library. You should refer to https://discordpy.readthedocs.io/en/rewrite/migrating.html for help migrating and join the official discord.py server to keep up to date with announcements regarding the rewrite branch.

th3infinity commented 6 years ago

startposition is just the position of the channel where i want the new one. But i didnt know that categories are not supported. Because all of them are inside categories. Is there any possibility to create the channel inside the categorie so i can move it?

Gonna look at the rewrite doc.

Harmon758 commented 6 years ago

Is there any possibility to create the channel inside the categorie so i can move it?

You'd have to switch to the rewrite branch to do that.