aboutsummaryrefslogtreecommitdiff
path: root/src/IRCBuffer.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-02 21:40:34 +0100
committerGravatar jesopo2018-10-02 21:40:34 +0100
commit9118af5e9c9c0e80507fd2bc8bc6cd840fad2c2f (patch)
tree8eace1a7d271b4f317d4009744a0ed0f8e970f0a /src/IRCBuffer.py
parentSimplify Utils.seperate_hostmask (diff)
signature
Support changing command responses from PRIVMSG to NOTICE
Diffstat (limited to 'src/IRCBuffer.py')
-rw-r--r--src/IRCBuffer.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/IRCBuffer.py b/src/IRCBuffer.py
index b3825178..f5e6fa70 100644
--- a/src/IRCBuffer.py
+++ b/src/IRCBuffer.py
@@ -2,12 +2,13 @@ import re
from . import Utils
class BufferLine(object):
- def __init__(self, sender, message, action, tags, from_self):
+ def __init__(self, sender, message, action, tags, from_self, method):
self.sender = sender
self.message = message
self.action = action
self.tags = tags
self.from_self = from_self
+ self.method = method
class Buffer(object):
def __init__(self, bot, server):
@@ -16,13 +17,19 @@ class Buffer(object):
self.lines = []
self.max_lines = 64
self._skip_next = False
- def add_line(self, sender, message, action, tags, from_self=False):
+
+ def _add_message(self, sender, message, action, tags, from_self, method):
if not self._skip_next:
- line = BufferLine(sender, message, action, tags, from_self)
+ line = BufferLine(sender, message, action, tags, from_self, method)
self.lines.insert(0, line)
if len(self.lines) > self.max_lines:
self.lines.pop()
self._skip_next = False
+ def add_message(self, sender, message, action, tags, from_self=False):
+ self._add_message(sender, message, action, tags, from_self, "PRIVMSG")
+ def add_notice(self, sender, message, tags, from_self=False):
+ self._add_message(sender, message, False, tags, from_self, "NOTICE")
+
def get(self, index=0, **kwargs):
from_self = kwargs.get("from_self", True)
for line in self.lines: