This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.js
137 lines (130 loc) · 3.26 KB
/
database.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const { connect, Schema, model, set } = require('mongoose');
const { ChalkAdvanced } = require('chalk-advanced');
const paginate = require('mongoose-paginate-v2');
set('strictQuery', true);
connect(process.env.DB, {})
.then(() =>
console.log(
`${ChalkAdvanced.gray('>')} ${ChalkAdvanced.green(
'✅ • Carregado com sucesso [BANCO DE DADOS]',
)}`,
),
)
.catch(err =>
console.log(
`${ChalkAdvanced.gray('>')} ${ChalkAdvanced.red(
'❎ • Conexão do banco de dados falhada',
)}`,
err,
),
);
const userSchema = new Schema({
_id: { type: String, required: true },
warns: Array,
});
const staffSchema = new Schema({
_id: { type: String, required: true },
serverIds: Array,
});
const guildSchema = new Schema({
_id: { type: String, required: true },
approved: { type: Boolean, default: false },
roleId: String,
channelsLockdown: Array,
channelsAutopublish: Array,
lockdownTime: Date,
logs: {
deletedMessage: String,
editedMessage: String,
joinedMember: String,
leftMember: String,
punishments: String,
},
welcome: {
active: { type: Boolean, default: false },
channel: String,
content: {
type: String,
default:
'{ "content": "Bem-vindo ao nosso servidor %membro, espero que se divirta aqui!" }',
},
timeout: { type: Number, default: 0 },
roles: Array,
},
exit: {
active: { type: Boolean, default: false },
channel: String,
content: {
type: String,
default: '{ "content": "Adeus %membro, espero que voltemo-nos a ver!" }',
},
timeout: { type: Number, default: 0 },
},
antifake: {
active: { type: Boolean, default: false },
time: { type: Number, default: 7200000 },
action: { type: String, default: 'Kick' },
channel: String,
},
automessage: [
{
_id: String,
channel: String,
interval: Number,
},
],
backup: {
password: String,
},
partnerWarning: {
activated: { type: Boolean, default: false },
channel: String,
message: {
type: String,
default: '{ "content": "Obrigado pela parceria %representante!" }',
},
},
rssfeeds: [
{
_id: String,
channel: String,
message: {
type: String,
default: '{ "content": "**%title**\\n%url" }',
},
disabled: Boolean,
lastItem: { type: String, default: '' },
penultimateItem: { type: String, default: '' },
},
],
vips: {
roles: Array,
registeredVips: [
{
_id: String,
expires: Date,
roleId: String,
},
],
},
});
const partnerSchema = new Schema({
_id: { type: String, required: true },
serverId: { type: String, required: true },
partners: { type: Number, default: 0 },
});
partnerSchema.plugin(paginate);
const reaperSchema = new Schema({
_id: { type: String, required: true },
databaseExclude: [
{
_id: { type: String, required: true },
schedule: { type: Date, required: true },
},
],
});
module.exports.Guilds = model('Guilds', guildSchema);
module.exports.Users = model('Users', userSchema);
module.exports.Staffs = model('Staffs', staffSchema);
module.exports.Partners = model('Partners', partnerSchema);
module.exports.Reaper = model('Reaper', reaperSchema);