<commit_before>import data.clients
import packetFactory
import struct
from microsofttranslator import Translator
from commands import Command
from config import YAMLConfig

import plugins as p

translation_config = YAMLConfig("cfg/translator.config.yml", {'app_id': '', 'secret_key': ''}, True)
translator = Translator(translation_config.get_key('app_id'), translation_config.get_key('secret_key'))


@p.on_connection_hook
def create_preferences(client):
    if client.playerId in data.clients.connectedClients:
        user_prefs = data.clients.connectedClients[client.playerId].get_preferences()
        if 'translate_chat' not in user_prefs:
            user_prefs['translate_chat'] = False<commit_msg>Move this to initial connect hook<commit_after>import data.clients
import packetFactory
import struct
from microsofttranslator import Translator
from commands import Command
from config import YAMLConfig

import plugins as p

translation_config = YAMLConfig("cfg/translator.config.yml", {'app_id': '', 'secret_key': ''}, True)
translator = Translator(translation_config.get_key('app_id'), translation_config.get_key('secret_key'))


@p.on_initial_connect_hook
def create_preferences(client):
    if client.playerId in data.clients.connectedClients:
        user_prefs = data.clients.connectedClients[client.playerId].get_preferences()
        if 'translate_chat' not in user_prefs:
            user_prefs['translate_chat'] = False
{'fraction_non_alphanumeric': 0.09337979094076655, 'fraction_numerical': 0.0, 'mean_word_length': 5.903846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7468732', 'n_tokens_mistral': 424, 'n_tokens_neox': 411, 'n_words': 96}