Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abc.GuildChannel.clone() method should accept a "category" argument #9939

Closed
PPearoo opened this issue Sep 6, 2024 · 2 comments
Closed

abc.GuildChannel.clone() method should accept a "category" argument #9939

PPearoo opened this issue Sep 6, 2024 · 2 comments
Labels
feature request This is a feature request.

Comments

@PPearoo
Copy link

PPearoo commented Sep 6, 2024

Summary

You can already specify a name for the category, there's no reason to limit this.

What is the feature request for?

The core library

The Problem

Let's say that someone is trying to create a 1:1 copy of a category, with all of its channels included. Currently, you'd do it with (2n+1) API calls, where n = number of channels inside a category.

  1. Creating a new category
  2. Cloning the channel in its current category
  3. Moving the new channel to the new category.

The Ideal Solution

This can be a bit tedious to code, and it also seems like a useless step, which could be avoided by adding a keyword-only optional argument, called "parent" or "category". This could accept either a CategoryChannel or an ID that points to a category inside the guild. If the given parent is invalid, it would raise a ValueError.

While this may seem like a small feature that is useless to most people, it could be really important in a bot which copies/clones categories. If a category had 50 channels for example, you'd need (2*50+1) = 101!!! API calls, almost half of which could be discarded by simply allowing people to actually choose a destination.

An other possible solution would be to add a data: dict argument to the clone implementation method, which would be harder for newbies to discover, but it would be much easier to use compared to making an attribute for everything that a channel can use when cloning.

The Current Solution

Currently, the best you can do is (as said above) clone and move the channel to another category. Cloning and moving takes twice the API calls to actually perform, this could be reduced by half with this feature's implementation.

Additional Context

No response

@PPearoo PPearoo added the feature request This is a feature request. label Sep 6, 2024
@codeofandrin
Copy link
Contributor

This feature has been added via #9941

@PPearoo
Copy link
Author

PPearoo commented Oct 10, 2024

This feature has been added via #9941

Thanks! :D

@PPearoo PPearoo closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request This is a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants