<commit_before>"use strict";
const objectPath = require('object-path'), language = require('languages'),
	db = require('./db') , glob = require('glob-promise'),
	path = require('path'), Seuelize = require('sequelize');
const langs = {};

module.exports = class {
	constructor() {
		this.id = '';
		this.lang =  '';
		this.logger;
		this.ready = false;
	}
	
	async set(msg, logger) {
		return new Promise(async(resolve, reject) => {
			if(Object.keys(langs).length == 0) {
				logger.info('Language: Language not loaded');
				await(async() => {
					let items = await glob(path.join(__dirname, 'lang_*.json'));
					for(let i of items) {
						let temp = require(i);
						langs[temp.lang.langname] = temp;
						logger.info('Language: \"'+temp.lang.langname+'\" Load complete');
					}
				})();
				logger.info('Language: Language load complete');
				this.ready = true;
			} else {
				this.ready = true;
			}

			if(typeof msg.from.language_code == 'undefined') {
				resolve(undefined);
			} else {
				this.id = msg.from.id;
				this.logger = logger;
				try {
					let query = await db.user.findOne({
						where: {
							id: this.id
						},
						attributes: [
							'id',
							'lang'
						]
					});
					if(!query.get || !query.get('lang')) {
						this.lang = msg.from.language_code.split('-')[0];
						resolve(query);<commit_msg>확인 범위 수정<commit_after>"use strict";
const objectPath = require('object-path'), language = require('languages'),
	db = require('./db') , glob = require('glob-promise'),
	path = require('path'), Seuelize = require('sequelize');
const langs = {};

module.exports = class {
	constructor() {
		this.id = '';
		this.lang =  '';
		this.logger;
		this.ready = false;
	}
	
	async set(msg, logger) {
		return new Promise(async(resolve, reject) => {
			if(Object.keys(langs).length == 0) {
				logger.info('Language: Language not loaded');
				await(async() => {
					let items = await glob(path.join(__dirname, 'lang_*.json'));
					for(let i of items) {
						let temp = require(i);
						langs[temp.lang.langname] = temp;
						logger.info('Language: \"'+temp.lang.langname+'\" Load complete');
					}
				})();
				logger.info('Language: Language load complete');
				this.ready = true;
			} else {
				this.ready = true;
			}

			if(typeof msg.from.language_code == 'undefined') {
				resolve(undefined);
			} else {
				this.id = msg.from.id;
				this.logger = logger;
				try {
					let query = await db.user.findOne({
						where: {
							id: this.id
						},
						attributes: [
							'id',
							'lang'
						]
					});
					if(!query || !query.get || !query.get('lang')) {
						this.lang = msg.from.language_code.split('-')[0];
						resolve(query);
{'fraction_non_alphanumeric': 0.18104405775638652, 'fraction_numerical': 0.001480932987782303, 'mean_word_length': 2.7064471879286693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6465624', 'n_tokens_mistral': 1161, 'n_tokens_neox': 898, 'n_words': 184}