Skip to content

Commit 2aab389

Browse files
noqqeSystem administrator
authored and
System administrator
committedSep 5, 2016
Ignore users is now possible
1 parent e64e9ae commit 2aab389

20 files changed

+53
-39
lines changed
 

‎README.md

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ id = voE
9494

9595
Optionen für Sprache: "de" oder "en"
9696

97+
# Ignore
98+
99+
List of users to ignore. Separated by comma.
100+
101+
user1,user2
102+
97103
# Sentences
98104

99105
Wenn man den Bot im Chat mit "Rezeptionistin" anspricht, wird das Sentences

‎config.ini.example

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ nick = Rezeptionistin
55
ircchan = #k4cg
66
debugchan = #k4cgdebug
77
nickservpassword = passw0rd
8+
ignore = user1,user2
89

910
[HTTP]
1011
useragent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3

‎plugins/alive.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def help_text(self, bot):
66

77
def on_msg(self, bot, user_nick, host, channel, message):
88
if message.lower().startswith('!gt'):
9-
bot.send_message(channel, bot.translate("alive_str1").format(nick=user_nick))
9+
bot.send_message(channel, bot.translate("alive_str1").format(nick=user_nick), user_nick)
1010

1111
def on_privmsg(self, bot, user_nick, host, message):
1212
if message.lower().startswith('!gt'):
13-
bot.send_message(user_nick, bot.translate("alive_str1").format(nick=user_nick))
13+
bot.send_message(user_nick, bot.translate("alive_str1").format(nick=user_nick), user_nick)
1414

‎plugins/eightball.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
class Eightball(Plugin):
55
def help_text(self, bot):
66
return bot.translate("eightball_help")
7-
7+
88
def answer(self, bot, msg, recipient, nick=None):
99
keywords = ["kann ich", "darf ich", "soll ich", "muss ich"]
1010
if any(msg.lower().startswith(k) for k in keywords):
1111
adressee = (nick + ": ") if nick else ""
1212

1313
if "oder" in msg:
14-
bot.send_message(recipient, adressee + random.choice(list(open('lists/alternate_answers.txt'))))
14+
bot.send_message(recipient, adressee + random.choice(list(open('lists/alternate_answers.txt'))), nick)
1515
else:
16-
bot.send_message(recipient, adressee + random.choice(list(open('lists/polar_answers.txt'))))
17-
16+
bot.send_message(recipient, adressee + random.choice(list(open('lists/polar_answers.txt'))), nick)
17+
1818
def on_msg(self, bot, user_nick, host, channel, message):
1919
self.answer(bot, message, channel, user_nick)
2020

‎plugins/flatter.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def on_msg(self, bot, user_nick, host, channel, message):
99
if message.lower().startswith(bot.translate("flatter_cmd")):
1010
if len(message.split()) >= 2:
1111
if bot.getlanguage() == "de":
12-
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/flattery.txt'))))
12+
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/flattery.txt'))), user_nick)
1313
elif bot.getlanguage() == "en":
14-
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/flattery_en.txt')))) # Source http://www.pickuplinesgalore.com/cheesy.html
15-
14+
# Source http://www.pickuplinesgalore.com/cheesy.html
15+
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/flattery_en.txt'))), user_nick)

‎plugins/help.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ def on_msg(self, bot, user_nick, host, channel, message):
99
text = plugin.help_text(bot)
1010
if text != "":
1111
for t in text.split("\n"):
12-
bot.send_message(user_nick, t)
12+
bot.send_message(user_nick, t, user_nick)
1313

‎plugins/insult.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def on_msg(self, bot, user_nick, host, channel, message):
99
if message.lower().startswith(bot.translate("insult_cmd")):
1010
if len(message.split()) >= 2:
1111
if bot.getlanguage() == "de":
12-
bot.send_message(channel, message.split()[1] + ", du " + random.choice(list(open('lists/insults.txt'))))
12+
bot.send_message(channel, message.split()[1] + ", du " + random.choice(list(open('lists/insults.txt'))), user_nick)
1313
elif bot.getlanguage() == "en":
14-
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/yomomma.txt')))) # source http://www.jokes4us.com/yomamajokes/yomamasofatjokes.html
14+
# source http://www.jokes4us.com/yomamajokes/yomamasofatjokes.html
15+
bot.send_message(channel, message.split()[1] + ", " + random.choice(list(open('lists/yomomma.txt'))), user_nick)

‎plugins/istheinternetonfire.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def on_msg(self, bot, user_nick, host, channel, message):
1313
#msg = re.sub('https?://[^\s]+', '', msg)
1414
if self.is_message_new(msg):
1515
self.save_message(msg)
16-
bot.send_message(channel, bot.translate("security_str1").format(msg=msg))
16+
bot.send_message(channel, bot.translate("security_str1").format(msg=msg), user_nick)
1717
if message.startswith("!security"):
18-
bot.send_message(channel, bot.translate("security_str1").format(msg=msg))
18+
bot.send_message(channel, bot.translate("security_str1").format(msg=msg), user_nick)
1919

2020
def save_message(self, msg):
2121
f = open('/tmp/.internetbrenntcache','w')

‎plugins/language.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ def on_msg(self, bot, user_nick, host, channel, message):
88
if message.lower().startswith('!lang'):
99
if len(message.split()) >= 2:
1010
if bot.setlanguage(message.split()[1]) == True:
11-
bot.send_message(channel, bot.translate("language_str1"))
11+
bot.send_message(channel, bot.translate("language_str1"), user_nick)
1212
else:
13-
bot.send_message(channel, bot.translate("language_str2"))
13+
bot.send_message(channel, bot.translate("language_str2"), user_nick)

‎plugins/light.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ def get_light(self):
3030
def on_msg(self, bot, user_nick, host, channel, message):
3131
if message.lower().startswith('!licht'):
3232
m = self.get_light()
33-
bot.send_message(channel, 'Momentane Lichtverhaeltnisse: ' + m)
33+
bot.send_message(channel, 'Momentane Lichtverhaeltnisse: ' + m, user_nick)

‎plugins/lineart.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def help_text(self, bot):
88
def on_msg(self, bot, user_nick, host, channel, message):
99
if message.lower().startswith('!lineart'):
1010
if len(message.split()) >= 1:
11-
bot.send_message(channel, random.choice(list(open('lists/lineart.txt'))))
11+
bot.send_message(channel, random.choice(list(open('lists/lineart.txt'))), user_nick)
1212

1313
def on_privmsg(self, bot, user_nick, host, message):
1414
if message.lower().startswith('!lineart'):
1515
if len(message.split()) >= 1:
16-
bot.send_message(user_nick, random.choice(list(open('lists/lineart.txt'))))
16+
bot.send_message(user_nick, random.choice(list(open('lists/lineart.txt'))), user_nick)

‎plugins/openstatus.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def on_msg(self, bot, user_nick, host, channel, message):
2323
f = msg['online']
2424

2525
if int(f) > 0:
26-
bot.send_message(channel, bot.translate("openstatus_str1").format(d=f))
26+
bot.send_message(channel, bot.translate("openstatus_str1").format(d=f), user_nick)
2727
else:
28-
bot.send_message(channel, bot.translate("openstatus_str2").format(d=f))
28+
bot.send_message(channel, bot.translate("openstatus_str2").format(d=f), user_nick)
2929
else:
3030
print "OpenStatus Error: [OpenStatus] url is not configured in your config.ini"
3131

‎plugins/playlist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def help_text(self, bot):
77

88
def on_msg(self, bot, user_nick, host, channel, message):
99
if message.lower().startswith('!np'):
10-
bot.send_message(channel, bot.translate("playlist_str1"))
10+
bot.send_message(channel, bot.translate("playlist_str1"), user_nick)

‎plugins/sentences.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ def on_msg(self, bot, user_nick, host, channel, message):
3535
else:
3636
sentence = self.get_markov_sentence()
3737

38-
bot.send_message(channel, bot.sanitize(sentence))
38+
bot.send_message(channel, bot.sanitize(sentence), user_nick)

‎plugins/shakespear_insult.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ def on_msg(self, bot, user_nick, host, channel, message):
2525
msg = message.split()[1] + ", thou " + insult
2626
else:
2727
msg = 'Thou ' + insult
28-
bot.send_message(channel, msg)
28+
bot.send_message(channel, msg, user_nick)

‎plugins/sound.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ def on_msg(self, bot, user_nick, host, channel, message):
3131
if message.lower().startswith('!geraeusche') or message.lower().startswith('!sound'):
3232
m = self.get_sound()
3333
if not m == '':
34-
bot.send_message(channel, 'Momentane Geraeuschintensitaet: ' + m + '/3300')
34+
bot.send_message(channel, 'Momentane Geraeuschintensitaet: ' + m + '/3300', user_nick)
3535
else:
36-
bot.send_message(channel, 'Geraeuschintensitaet konnte *nicht* abgefragt werden')
36+
bot.send_message(channel, 'Geraeuschintensitaet konnte *nicht* abgefragt werden', user_nick)

‎plugins/tell.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def tell(self, bot, user_nick, receiver, message):
2424

2525
if message.lower().startswith(bot.translate("tell_cmd")):
2626
if (len(message.rstrip().split()) < 3) or (len(bot.split_by_nth(message.rstrip(), 2)[1]) <= 0):
27-
bot.send_message(reply_to, user_nick + bot.translate("tell_str1"))
27+
bot.send_message(reply_to, user_nick + bot.translate("tell_str1"), user_nick)
2828
elif len(bot.split_by_nth(message, 2)[1]) > 144:
29-
bot.send_message(reply_to, user_nick + bot.translate("tell_str2"))
29+
bot.send_message(reply_to, user_nick + bot.translate("tell_str2"), user_nick)
3030
else:
3131
recipient = message.split()[1]
3232
message = message.split(recipient)[1].strip()
@@ -46,13 +46,13 @@ def tell(self, bot, user_nick, receiver, message):
4646
with open('tell_messages.json', 'w+') as outfile:
4747
json.dump(self.messages, outfile)
4848

49-
bot.send_message(reply_to, bot.translate("tell_str3"))
49+
bot.send_message(reply_to, bot.translate("tell_str3"), user_nick)
5050

5151
def on_join(self, bot, user_nick, host, channel):
5252
user_messages = [message for message in self.messages if message["recipient"] == user_nick]
5353
for message in user_messages:
5454
if (not message["send_to"].startswith("#")) or (message["send_to"][1:] == channel):
55-
bot.send_message(message["send_to"], user_nick + ", " + message["sender"] + " liess dir am " + message["date"] + " um " + message["time"] + " Uhr ausrichten: " + message["message"])
55+
bot.send_message(message["send_to"], user_nick + ", " + message["sender"] + " liess dir am " + message["date"] + " um " + message["time"] + " Uhr ausrichten: " + message["message"], user_nick)
5656
self.messages.remove(message)
5757

5858
with open('tell_messages.json', 'w+') as outfile:

‎plugins/temperature.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ def on_msg(self, bot, user_nick, host, channel, message):
3737
temp_outdoor = self.get_outdoor_temp(bot)
3838

3939
if temp is not "":
40-
bot.send_message(channel, bot.translate("temp_str1").format(temp=temp) + " " + bot.translate("temp_str2").format(temp=temp_outdoor))
40+
bot.send_message(channel, bot.translate("temp_str1").format(temp=temp) + " " + bot.translate("temp_str2").format(temp=temp_outdoor), user_nick)
4141
else:
42-
bot.send_message(channel, bot.translate("temp_str3").format(temp=temp_outdoor))
42+
bot.send_message(channel, bot.translate("temp_str3").format(temp=temp_outdoor), user_nick)
4343

4444
def on_privmsg(self, bot, user_nick, host, message):
4545
if message.lower().startswith('!kt'):
4646
temp = self.get_indoor_temp(bot)
4747
temp_outdoor = self.get_outdoor_temp(bot)
4848

4949
if temp is not "":
50-
bot.send_message(user_nick, bot.translate("temp_str1").format(temp=temp) + " " + bot.translate("temp_str2").format(temp=temp_outdoor))
50+
bot.send_message(user_nick, bot.translate("temp_str1").format(temp=temp) + " " + bot.translate("temp_str2").format(temp=temp_outdoor), user_nick)
5151
else:
52-
bot.send_message(user_nick, bot.translate("temp_str3").format(temp=temp_outdoor))
52+
bot.send_message(user_nick, bot.translate("temp_str3").format(temp=temp_outdoor), user_nick)

‎plugins/urls.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ def on_msg(self, bot, user_nick, host, channel, message):
1010
title = bot.sanitize(bot.geturltitle(url))
1111
if not title == "":
1212
if message.lower().startswith('!private') or message.lower().startswith('!pr'):
13-
bot.send_message(channel, "[private] " + "Title: {title}".format(title=title))
13+
bot.send_message(channel, "[private] " + "Title: {title}".format(title=title), user_nick)
1414
elif message.lower().startswith('!nsfw'):
15-
bot.send_message(channel, "[nsfw] " + "Title: {title}".format(title=title))
15+
bot.send_message(channel, "[nsfw] " + "Title: {title}".format(title=title), user_nick)
1616
else:
17-
bot.send_message(channel, "Title: {title}".format(title=title))
17+
bot.send_message(channel, "Title: {title}".format(title=title), user_nick)
1818
print bot.get_plugin("MediaWiki").wikiupdate(title, url)

‎rezeptionistin.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ def __init__(self):
4747
self.useragent=self.config.get('HTTP', 'useragent')
4848
self.language=self.config.get('Language','language')
4949

50+
try:
51+
self.ignore=self.config.get('IRC','ignore').split(',')
52+
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
53+
self.ignore = []
54+
5055
# load translation keys
5156

5257
# load optional config
@@ -122,8 +127,9 @@ def split_by_nth(self, text, n, seperator=' '):
122127
res_l.extend(res_r)
123128
return res_l
124129

125-
def send_message(self, recipient, msg):
126-
self.irc.msg(recipient, "\x0F" + msg)
130+
def send_message(self, recipient, msg, srcuser=''):
131+
if srcuser not in self.ignore:
132+
self.irc.msg(recipient, "\x0F" + msg)
127133

128134
def send_command(self, recipient, cmd):
129135
self.irc.msg(recipient, cmd)

0 commit comments

Comments
 (0)
Please sign in to comment.