pydle
pydle copied to clipboard
How to access tags (ircv3.TaggedMessageSupport)
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!
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!