From fe141b288f7cfba30146f5fb8361121a6c3783cb Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Mon, 31 Oct 2016 22:22:48 -0400 Subject: [PATCH] Allow specifying a prefix (e.g. for channels) for context.send() --- src/context.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/context.py b/src/context.py index bcc6992..0371aa8 100644 --- a/src/context.py +++ b/src/context.py @@ -65,6 +65,9 @@ class IRCContext: extra, line = line[:length], line[length:] client.send("{0} {1} :{2}".format(send_type, name, extra)) - def send(self, data, target=None, *, notice=False, privmsg=False): + def send(self, data, target=None, *, notice=False, privmsg=False, prefix=None): send_type = self.get_send_type(is_notice=notice, is_privmsg=privmsg) - self._send(data, self.client, send_type, self.name) + name = self.name + if prefix is not None: + name = prefix + name + self._send(data, self.client, send_type, name)