pydle icon indicating copy to clipboard operation
pydle copied to clipboard

How to access tags (ircv3.TaggedMessageSupport)

Open svkurowski opened this issue 8 years ago • 1 comments

I am interested in accessing the tags of private messages. Currently I do this in the following fashion:

class PrivMessageTagSupport(pydle.features.ircv3.TaggedMessageSupport):
  def on_raw_privmsg(self, message):
    """ PRIVMSG command. """
    nick, metadata = self._parse_user(message.source)
    tags = message.tags
    target, message = message.params

    self._sync_user(nick, metadata)

    self.on_message(target, nick, message, tags)
    if self.is_channel(target):
        self.on_channel_message(target, nick, message, tags)
    else:
        self.on_private_message(nick, message, tags)

Which is mostly a copy-paste of the on_raw_privmsg method of RFC1459Support and feels kind of messy. Is this the recommended way of handling tagged messages? Or do you have any plans to make access of tags easier in the library?

Thanks for the great work btw!

svkurowski avatar Jun 10 '16 11:06 svkurowski

Hi! Accessing tags in an easier way is definitely planned, I'm just still mulling over the API for it. Right now, this sadly is the best way. I'm hoping to have it added in 0.9.

Thanks for using!

shizmob avatar Jun 18 '16 13:06 shizmob