Twentysix26 / x26-Cogs

General purpose cogs for Red V3
GNU General Public License v3.0
41 stars 28 forks source link

[Bug] Invite Filter/Warden Condition Acting Upon Friend Invites #82

Open EternalllZM opened 3 months ago

EternalllZM commented 3 months ago

Cog

Describe the bug Similar to #57 and #73 , a Discord friend invite (uses discord.com/invite/XXXXX url) will trigger a false positive as if it were an invite.

To Reproduce Steps to reproduce the behavior:

  1. Post a friend link
  2. Any warden action looking for invites or the invite filter will trigger.

Expected behavior Should be configurable or acknowledge friend invite links.

Screenshots image image

DoctorDinosaur commented 1 month ago

Doesn't seem like there's a good way to tell between server and friend invites, short of resolving the link.

Rn warden uses the regex filter from https://docs.discord.red/en/stable/framework_utils.html#redbot.core.utils.common_filters.filter_invites

Edit: https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.fetch_invite seems to raise an error when it fetches the invite, as per the "I could not gather more information" in the screenshot

But that could also just mean the invite is an invalid server invite, so it can't be used to check for friend invite links.

There doesn't seem to be a way in discord.py to resolve friend invite links, maybe when they're less hidden...

EternalllZM commented 1 month ago

Edit: https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.fetch_invite seems to raise an error when it fetches the invite, as per the "I could not gather more information" in the screenshot

But that could also just mean the invite is an invalid server invite, so it can't be used to check for friend invite links.

There doesn't seem to be a way in discord.py to resolve friend invite links, maybe when they're less hidden...

Potentially creating a condition for unresolved invites versus matched external/internal ones would solve this.