aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2017-10-27 13:15:33 +0100
committerGravatar jesopo2017-10-27 13:15:33 +0100
commit0df7abb03e2a75744a575bc9a7b349fa98d6f485 (patch)
treef6a4a5f952f030108371588347a45f0cea684eed /modules
parentAmber Rudd (diff)
signature
Handle empty CAP, additional IRCLog feature, better tls, better channel_save logic, add sed-sender-only setting
Signed-off-by: jesopo <github@lolnerd.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/channel_save.py14
-rw-r--r--modules/commands.py3
-rw-r--r--modules/sed.py11
3 files changed, 22 insertions, 6 deletions
diff --git a/modules/channel_save.py b/modules/channel_save.py
index 713a7cb5..35a62626 100644
--- a/modules/channel_save.py
+++ b/modules/channel_save.py
@@ -22,8 +22,12 @@ class Module(object):
if event["line_split"][3].lower() == "#bitbot" or event["number"]=="001":
channels = event["server"].get_setting("autojoin", [])
chan_keys = event["server"].get_setting("channel_keys", {})
- for channel in channels:
- if channel in chan_keys:
- event["server"].send_join(channel, key=chan_keys[channel])
- else:
- event["server"].send_join(channel)
+ channels_sorted = sorted(channels,
+ key=lambda x: 0 if x in chan_keys else 1)
+
+ keys_sorted = map(lambda x: x[1],
+ sorted(chan_keys.items(),
+ key=lambda x: channels_sorted.index(x[0])))
+ event["server"].send_join(
+ ",".join(channels_sorted), ",".join(keys_sorted))
+
diff --git a/modules/commands.py b/modules/commands.py
index 8a811e2e..6985c869 100644
--- a/modules/commands.py
+++ b/modules/commands.py
@@ -1,3 +1,4 @@
+import re
import Utils
STR_MORE = "%s (more...)" % Utils.FONT_RESET
@@ -5,6 +6,8 @@ STR_CONTINUED = "(...continued) "
OUT_CUTOFF = 400
+REGEX_CUTOFF = re.compile("^.{1,%d}(?:\s|$)" % OUT_CUTOFF)
+
class Out(object):
def __init__(self, module_name, target):
self.module_name = module_name
diff --git a/modules/sed.py b/modules/sed.py
index 460dfd81..77c6f9a2 100644
--- a/modules/sed.py
+++ b/modules/sed.py
@@ -16,6 +16,11 @@ class Module(object):
"channelset").call(setting="sed",
help="Disable/Enable sed in a channel",
validate=Utils.bool_or_none)
+ self.bot.events.on("postboot").on("configure").on(
+ "channelset").call(setting="sed-sender-only",
+ help=
+ "Disable/Enable sed only looking at the messages sent by the user",
+ validate=Utils.bool_or_none)
def channel_message(self, event):
if event["action"] or not Utils.get_closest_setting(event, "sed", True):
@@ -51,7 +56,11 @@ class Module(object):
return
replace = sed_split[2].replace("\\/", "/")
- line = event["channel"].log.find(pattern, from_self=False, not_pattern=REGEX_SED)
+ for_user = event["user"].nickname if Utils.get_closest_setting(
+ event, "sed-sender-only", False
+ ) else None
+ line = event["channel"].log.find(pattern, from_self=False,
+ for_user=for_user, not_pattern=REGEX_SED)
if line:
new_message = re.sub(pattern, replace, line.message, count)
if line.action: