mirror of
https://github.com/nichkara/InfinitumBotty.git
synced 2026-06-11 06:36:24 +02:00
Add "template" support for first-greet to put the nickname into the greeting instead of only at the end
This commit is contained in:
@@ -2,6 +2,8 @@ from FaustBot.Communication.Connection import Connection
|
|||||||
from FaustBot.Modules.JoinObserverPrototype import JoinObserverPrototype
|
from FaustBot.Modules.JoinObserverPrototype import JoinObserverPrototype
|
||||||
from FaustBot.Model.UserProvider import UserProvider
|
from FaustBot.Model.UserProvider import UserProvider
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
class First_Greeter(JoinObserverPrototype):
|
class First_Greeter(JoinObserverPrototype):
|
||||||
"""
|
"""
|
||||||
A Class only reacting to pings
|
A Class only reacting to pings
|
||||||
@@ -20,12 +22,15 @@ class First_Greeter(JoinObserverPrototype):
|
|||||||
self.first_greeting = greeting
|
self.first_greeting = greeting
|
||||||
|
|
||||||
def update_on_join(self, data, connection: Connection):
|
def update_on_join(self, data, connection: Connection):
|
||||||
if data['channel'] == connection.details.get_channel():
|
if data["channel"] == connection.details.get_channel():
|
||||||
if data['nick'].find("Guest") != -1:
|
new_nick = data["nick"]
|
||||||
|
if (
|
||||||
|
new_nick.startswith("Guest")
|
||||||
|
or UserProvider().get_characters(new_nick) < 100
|
||||||
|
):
|
||||||
sleep(20)
|
sleep(20)
|
||||||
connection.send_back(self.first_greeting + " " + data['nick'], data)
|
if "{NICK}" in self.first_greeting:
|
||||||
return
|
greeting = self.first_greeting.replace("{NICK}", new_nick)
|
||||||
UProvider= UserProvider()
|
else:
|
||||||
if(UProvider.get_characters(data['nick'])) < 100:
|
greeting = f"{self.first_greeting} {new_nick}"
|
||||||
sleep(20)
|
connection.send_back(greeting, data)
|
||||||
connection.send_back(self.first_greeting + " " + data['nick'], data)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user