-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.py
More file actions
29 lines (20 loc) · 662 Bytes
/
Copy pathwelcome.py
File metadata and controls
29 lines (20 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Greets specified people entering with messages
Options
^^^^^^^
.. code-block:: toml
[welcome]
welcomes = { nota = "Hi notafile", feik = "Hi feik" }
.. codeauthor: mat^2
"""
from piqueserver.config import config
welcome_config = config.section("welcome")
welcomes_option = welcome_config.option("welcomes", {})
def apply_script(protocol, connection, config):
welcomes = welcomes_option.get()
class EnterConnection(connection):
def on_login(self, name):
if name in welcomes:
self.protocol.broadcast_chat(welcomes[name])
connection.on_login(self, name)
return protocol, EnterConnection