Skip to content
This repository was archived by the owner on Aug 4, 2020. It is now read-only.

Commit da1eb8e

Browse files
author
Adam Roses Wight
committed
(#11) Respond to CTCP SOURCE
1 parent d9f1d73 commit da1eb8e

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ This is... sort of the configuration file used for the CiviCRM project:
5353
# Measured in seconds
5454
poll_interval: 60
5555

56-
# Override the builtin URL so people know how to contribute.
57-
project_url: https://svn.civicrm.org/tools/trunk/bin/scripts/ircbot-civi.py
56+
# Override the builtin URL if you have forked this project, so people know
57+
# how to contribute.
58+
source_url: https://svn.civicrm.org/tools/trunk/bin/scripts/ircbot-civi.py
5859

5960
Running
6061
=======

brain.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ class Brain(object):
77
def __init__(self, config, sink=None):
88
self.config = config
99
self.sink = sink
10-
self.project_url = "https://github.com/adamwight/slander"
1110
if "irc" in self.config:
1211
if "ownermail" in self.config["irc"]:
1312
self.config["irc"]["ownermail"] = "xxx@example.com"
1413
if "regverify" in self.config["irc"]:
1514
self.config["irc"]["regverify"] = "*******"
16-
if "project_url" in self.config:
17-
self.project_url = self.config["project_url"]
15+
16+
self.source_url = self.config["source_url"]
1817

1918
def say(self, message, force=False):
2019
if not force and 'mute' in self.config and int(self.config['mute']):
@@ -24,7 +23,7 @@ def say(self, message, force=False):
2423

2524
def respond(self, user, message):
2625
if re.search(r'\bhelp\b', message):
27-
self.say("If I only had a brain: %s -- Commands: help config kill last" % (self.project_url, ))
26+
self.say("If I only had a brain: %s -- Commands: help config kill last" % (self.source_url, ))
2827
elif re.search(r'\bconfig\b', message):
2928
match = re.search(r'\b(?P<name>[^=\s]+)\s*=\s*(?P<value>\S+)', message)
3029
if match:

irc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def connectionMade(self):
2323
if "maxlen" in self.config["irc"]:
2424
text.maxlen = self.config["irc"]["maxlen"]
2525

26+
self.sourceURL = self.config["source_url"]
27+
2628
irc.IRCClient.connectionMade(self)
2729

2830
if "pass" in self.config["irc"]:

slander.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def parse_args(args):
3636
if not config:
3737
sys.exit(args[0] + ": No config!")
3838

39+
# normalize some stuff :(
40+
if "source_url" not in config:
41+
config["source_url"] = "https://github.com/adamwight/slander"
42+
3943
global test
4044
test = False
4145
if "test" in config:

0 commit comments

Comments
 (0)