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

Channel Converters should support channel links #9799

Closed
TrustyJAID opened this issue Apr 21, 2024 · 2 comments
Closed

Channel Converters should support channel links #9799

TrustyJAID opened this issue Apr 21, 2024 · 2 comments
Labels
feature request This is a feature request.

Comments

@TrustyJAID
Copy link

TrustyJAID commented Apr 21, 2024

Summary

Channel Converters should support channel links

What is the feature request for?

discord.ext.commands

The Problem

Discord is now providing channel jump links in the client and even renders them to look like channel mentions. As a result, some users are attempting to use the jump link to the channel instead of traditional mentions or ID's inside commands. This is failing and causing unexpected results in some cases.

The Ideal Solution

Add support in the GuildChannelConverter to parse and find channels based on a provided jump link to the channel.

The Current Solution

The current solution is including a secondary converter alongside a ChannelConverter just to detect jump links and extract channel ID that way.

Additional Context

No response

@TrustyJAID TrustyJAID added the feature request This is a feature request. label Apr 21, 2024
@Rapptz
Copy link
Owner

Rapptz commented Jun 2, 2024

This feature idea is okay, but I think it has some unintended consequence with potential information leakage that wasn't present before. For example, right now, if you have discord.TextChannel as a type hint for your command with a @guild_only() decorator, then you can be reasonably sure that the TextChannel exists only within the confines of that guild but with URLs you now have access to external channels. This is actually a subtle problem in the pre-existing message converters which means that users have to deal with it. I'd prefer to not let people have to deal with it here, but some people might actually want external channels so it's an odd balance. Personally, I err on the side of "if you're running this in a guild context, then it should only match channels within the guild".

@TrustyJAID
Copy link
Author

Realistically what I would expect from the library is to just extract the channel ID from the jump link and if that channel doesn't exist within the current context raise BadArgument error. If I want to accept channels outside of the current guild then I will gladly write my own converter for that since it's a less common use-case. I was also thinking about this and how to handle message jump links since you could extract the channel ID from that as well to get the channel context. I think the same should apply there, extract the channel ID and ignore everything else.

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