-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathLoginMessage.py
More file actions
41 lines (36 loc) · 1.24 KB
/
LoginMessage.py
File metadata and controls
41 lines (36 loc) · 1.24 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
import commands
import config
import data.clients
import packetFactory
import plugins.proxyplugins as plugins
login_config = config.YAMLConfig(
"cfg/loginmessage.config.yml",
{
'message': "{{yel}}Welcome to PSO2Proxy build {proxy_ver} "
"{client_name}! There are currently {client_count} clients "
"connected. Use {command_prefix}help for a list of commands!",
'messageType': 0x3
},
True
)
@plugins.on_initial_connect_hook
def login_message(sender):
server_name = "Unknown"
try:
import PSO2PDConnector
server_name = PSO2PDConnector.connector_conf['server_name']
except ImportError:
pass
message = login_config['message'].format(
client_name=sender.myUsername,
client_count=len(data.clients.connectedClients),
proxy_ver=config.proxy_ver,
command_prefix=config.globalConfig['commandPrefix'],
server_name=server_name
)
sender.send_crypto_packet(packetFactory.SystemMessagePacket(message, login_config['messageType']).build())
@plugins.CommandHook("reloadloginmessage")
class ReloadConfig(commands.Command):
def call_from_console(self):
login_config._load_config()
return "[LoginMessage] Message file reloaded"