fixed bugs
This commit is contained in:
@@ -1,24 +1,23 @@
|
|||||||
const { User } = require("./user");
|
const { User } = require("./user");
|
||||||
const { Website } = require("./website");
|
const { Website } = require("./website");
|
||||||
|
|
||||||
module.exports.data = new StructuredData();
|
|
||||||
|
|
||||||
class StructuredData {
|
class StructuredData {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.data={};
|
this.data={};
|
||||||
}
|
}
|
||||||
|
|
||||||
addUser(id){
|
addUser(id){
|
||||||
if(this.data[id] != undefined)
|
if(this.data[id] != undefined)
|
||||||
{
|
{
|
||||||
this.data[id] = new User(id);
|
this.data[id] = new User(id);
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {number} id
|
* @param {number} id
|
||||||
@@ -27,20 +26,22 @@ class StructuredData {
|
|||||||
getUser(id){
|
getUser(id){
|
||||||
return this.data[id];
|
return this.data[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUser(id){
|
deleteUser(id){
|
||||||
if(this.data[id] != undefined)
|
if(this.data[id] != undefined)
|
||||||
{
|
{
|
||||||
return delete this.data[id];
|
return delete this.data[id];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.data = new StructuredData();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
data structured:
|
data structured:
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const commands = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onMessage = (message, client) => {
|
module.exports= onMessage = (message, client) => {
|
||||||
|
|
||||||
let command = null;
|
let command = null;
|
||||||
|
|
||||||
@@ -54,6 +54,6 @@ const onMessage = (message, client) => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.onMessage = onMessage;
|
|
||||||
|
|
||||||
//export default onMessage;
|
//export default onMessage;
|
||||||
Reference in New Issue
Block a user