-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
53 lines (50 loc) · 990 Bytes
/
db.js
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
42
43
44
45
46
47
48
49
50
51
52
53
const mongo = require('mongoose');
mongo.connect(process.env.db, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(connect => console.log("[MONGODB] Connected")).catch(err => console.error("[MONGODB] Erro " + err.stack));
const Schema = mongo.Schema;
const User = new Schema({
_id: String,
about: String,
economy: {
coins: Number
},
lang: { type: String, default: "pt-br", required: true }
});
const Guild = new Schema({
_id: String,
name: String,
icon: String,
bio: String,
verified: Boolean,
config: {
welcome: {
channel: String,
message: String
},
bye: {
channel: String,
message: String
},
system: {
antispam: {
config: {
blacklist: Array
},
check: {
default: false,
type: Boolean,
required: true
}
},
antilink: {
default: false,
type: Boolean,
required: true
}
}
}
})
module.exports.guild = new mongo.model("guild", Guild)
module.exports.user = new mongo.model("user", User)