ppy / osu-api

Public API for accessing osu! related data.
320 stars 16 forks source link

Implement IRCv3 Message Tags #320

Open ThePooN opened 2 years ago

ThePooN commented 2 years ago

Since the inception of the Bancho IRC gateway, bot devs have been plagued with the issue of resolving IRC usernames to user IDs for API requests.

Workarounds in place in APIv1 partially solve this issue, but not all of them (eg. mixed spaces and underscores). There even are instances of accounts with different usernames but identical IRC usernames.

A few examples of the issues it has been causing:

IRCv3 message tags are a backwards-compatible extension to the IRC spec that allows to ship additional metadata with messages; we could ship real username and user id alongside every message for example to address these issues.

Twitch chat still uses IRC to this day, and they rely on IRCv3 to implement many of their features and it works very well; see their doc: https://dev.twitch.tv/docs/irc/tags

To maintain backward compatibility, IRCv3 tags are optional and must be requested by the client, for example by sending: CAP REQ :osu.ppy.sh/tags. All messages received from the server (using PRIVMSG) would then be prepended by @user-id=718454 for example.

peppy commented 2 years ago

Took a quick look into implementing this today, but it's going to take some semi-large refactoring. Individual messages are cached at a byte level for efficiency, which means how they are formatted cannot currently differ from user to user as simply as one may hope.

I'll try and see if there's a hacky way we can work around this limitation over the coming days.

ThePooN commented 2 years ago

Is there any update on this?

peppy commented 2 years ago

no