added the possibility to individualize greetings

This commit is contained in:
BaerbelBox
2022-07-15 08:57:42 +02:00
parent 2777010b2e
commit cd9cb5dc5d
4 changed files with 12 additions and 6 deletions

View File

@@ -175,7 +175,7 @@ class DuckObserver(PrivMsgObserverPrototype, PingObserverPrototype):
if nick == self.streakname:
self.streak+=1
else:
self.streak = 0
self.streak = 1
self.streakname = nick
if self.streak == 3:

View File

@@ -16,9 +16,10 @@ class Greeter(JoinObserverPrototype):
def help():
return None
def __init__(self):
def __init__(self, greeting):
super().__init__()
self.names = defaultdict(int)
self.greeting = greeting
def update_on_join(self, data, connection: Connection):
if data['channel'] == connection.details.get_channel():
@@ -27,5 +28,5 @@ class Greeter(JoinObserverPrototype):
connection.send_back("Herzlich Willkommen bei uns "+data['nick'],data)
self.names[data['nick']] = int(time.time())
return
connection.send_back("Hallo " + data['nick'], data)
connection.send_back(self.greeting+" " + data['nick'], data)
self.names[data['nick']] = int(time.time())