Moved from Enmap/SQLite to MongoDB
This commit is contained in:
parent
7d1ca165b7
commit
606c1ea1dc
11 changed files with 214 additions and 112 deletions
|
@ -1,6 +1,6 @@
|
|||
const database = require("../utils/database.js");
|
||||
|
||||
exports.run = async (message) => {
|
||||
const guildConf = database.settings.get(message.channel.guild.id);
|
||||
return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guildConf.prefix}\`.`;
|
||||
const guild = (await database.find({ id: message.channel.guild.id }).exec())[0];
|
||||
return `${message.author.mention}, my command list can be found here: https://essem.space/esmBot/commands.html?dev=true\nThis server's prefix is \`${guild.prefix}\`.`;
|
||||
};
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
const database = require("../utils/database.js");
|
||||
|
||||
exports.run = async (message, args) => {
|
||||
const guild = (await database.find({ id: message.channel.guild.id }).exec())[0];
|
||||
if (args.length !== 0) {
|
||||
if (!message.member.permission.has("administrator") && message.member.id !== "198198681982205953") return `${message.author.mention}, you need to be an administrator to change the bot prefix!`;
|
||||
database.settings.set(message.channel.guild.id, args[0], "prefix");
|
||||
guild.set("prefix", args[0]);
|
||||
await guild.save();
|
||||
return `The prefix has been changed to ${args[0]}.`;
|
||||
} else {
|
||||
return `${message.author.mention}, the current prefix is \`${database.settings.get(message.channel.guild.id, "prefix")}\`.`;
|
||||
return `${message.author.mention}, the current prefix is \`${guild.prefix}\`.`;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,41 +1,44 @@
|
|||
const tags = require("../utils/database.js").tags;
|
||||
const database = require("../utils/database.js");
|
||||
const config = require("../config.json");
|
||||
const client = require("../utils/client.js");
|
||||
const paginator = require("../utils/pagination/pagination.js");
|
||||
const { random } = require("../utils/misc.js");
|
||||
|
||||
exports.run = async (message, args) => {
|
||||
const guild = (await database.find({ id: message.channel.guild.id }).exec())[0];
|
||||
const tags = guild.tags;
|
||||
const blacklist = ["add", "edit", "remove", "delete", "list", "random"];
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "add":
|
||||
if (args[1] === undefined) return `${message.author.mention}, you need to provide the name of the tag you want to add!`;
|
||||
if (blacklist.indexOf(args[1].toLowerCase()) > -1) return `${message.author.mention}, you can't make a tag with that name!`;
|
||||
if (tags.has(message.channel.guild.id, args[1].toLowerCase())) return `${message.author.mention}, this tag already exists!`;
|
||||
await setTag(args.slice(2).join(" "), args[1].toLowerCase(), message);
|
||||
if (tags.exists(args[1].toLowerCase())) return `${message.author.mention}, this tag already exists!`;
|
||||
await setTag(args.slice(2).join(" "), args[1].toLowerCase(), message, guild);
|
||||
return `${message.author.mention}, the tag \`${args[1].toLowerCase()}\` has been added!`;
|
||||
case "delete":
|
||||
case "remove":
|
||||
if (args[1] === undefined) return `${message.author.mention}, you need to provide the name of the tag you want to delete!`;
|
||||
if (!tags.has(message.channel.guild.id, args[1].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
if (tags.get(message.channel.guild.id, args[1].toLowerCase()).author !== message.author.id && tags.get(message.channel.guild.id, args[1].toLowerCase()).author !== config.botOwner) return `${message.author.mention}, you don't own this tag!`;
|
||||
tags.delete(message.channel.guild.id, args[1].toLowerCase());
|
||||
if (!tags.exists(args[1].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
if (tags[args[1].toLowerCase()].author !== message.author.id && tags[args[1].toLowerCase()].author !== config.botOwner) return `${message.author.mention}, you don't own this tag!`;
|
||||
tags.set(args[1].toLowerCase(), undefined);
|
||||
await guild.save();
|
||||
return `${message.author.mention}, the tag \`${args[1].toLowerCase()}\` has been deleted!`;
|
||||
case "edit":
|
||||
if (args[1] === undefined) return `${message.author.mention}, you need to provide the name of the tag you want to edit!`;
|
||||
if (!tags.has(message.channel.guild.id, args[1].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
if (tags.get(message.channel.guild.id, args[1].toLowerCase()).author !== message.author.id && tags.get(message.channel.guild.id, args[1].toLowerCase()).author !== config.botOwner) return `${message.author.mention}, you don't own this tag!`;
|
||||
await setTag(args.slice(2).join(" "), args[1].toLowerCase(), message);
|
||||
if (!tags.exists(args[1].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
if (tags[args[1].toLowerCase()].author !== message.author.id && tags[args[1].toLowerCase()].author !== config.botOwner) return `${message.author.mention}, you don't own this tag!`;
|
||||
await setTag(args.slice(2).join(" "), args[1].toLowerCase(), message, guild);
|
||||
return `${message.author.mention}, the tag \`${args[1].toLowerCase()}\` has been edited!`;
|
||||
case "list":
|
||||
if (!message.channel.guild.members.get(client.user.id).permission.has("addReactions") && !message.channel.permissionsOf(client.user.id).has("addReactions")) return `${message.author.mention}, I don't have the \`Add Reactions\` permission!`;
|
||||
if (!message.channel.guild.members.get(client.user.id).permission.has("embedLinks") && !message.channel.permissionsOf(client.user.id).has("embedLinks")) return `${message.author.mention}, I don't have the \`Embed Links\` permission!`;
|
||||
var pageSize = 15;
|
||||
var embeds = [];
|
||||
var groups = Object.keys(tags.get(message.channel.guild.id)).map((item, index) => {
|
||||
return index % pageSize === 0 ? Object.keys(tags.get(message.channel.guild.id)).slice(index, index + pageSize) : null;
|
||||
}).filter((item) => {
|
||||
return item;
|
||||
console.log(Array.from(tags.keys()));
|
||||
var groups = Array.from(tags.keys()).map((item, index) => {
|
||||
return index % pageSize === 0 ? Array.from(tags.keys()).slice(index, index + pageSize) : null;
|
||||
});
|
||||
console.log(groups);
|
||||
for (const [i, value] of groups.entries()) {
|
||||
embeds.push({
|
||||
"embed": {
|
||||
|
@ -55,21 +58,22 @@ exports.run = async (message, args) => {
|
|||
if (embeds.length === 0) return `${message.author.mention}, I couldn't find any tags!`;
|
||||
return paginator(message, embeds);
|
||||
case "random":
|
||||
return tags.get(message.channel.guild.id, random(Object.keys(tags.get(message.channel.guild.id)))).content;
|
||||
return tags[random(Object.keys(tags))].content;
|
||||
default:
|
||||
if (args.length === 0) return `${message.author.mention}, you need to specify the name of the tag you want to view!`;
|
||||
if (!tags.has(message.channel.guild.id, args[0].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
return tags.get(message.channel.guild.id, `${args[0].toLowerCase()}.content`);
|
||||
if (!tags.exists(args[0].toLowerCase())) return `${message.author.mention}, this tag doesn't exist!`;
|
||||
return tags[`${args[0].toLowerCase()}.content`];
|
||||
}
|
||||
};
|
||||
|
||||
const setTag = async (content, name, message) => {
|
||||
const setTag = async (content, name, message, guild) => {
|
||||
if (content === undefined || content.length === 0) return `${message.author.mention}, you need to provide the content of the tag!`;
|
||||
if (message.attachments.length !== 0) {
|
||||
tags.set(message.channel.guild.id, { content: `${content} ${message.attachments[0].url}`, author: message.author.id }, name);
|
||||
guild.tags.set(name, { content: `${content} ${message.attachments[0].url}`, author: message.author.id });
|
||||
} else {
|
||||
tags.set(message.channel.guild.id, { content: content, author: message.author.id }, name);
|
||||
guild.tags.set(name, { content: content, author: message.author.id });
|
||||
}
|
||||
await guild.save();
|
||||
};
|
||||
|
||||
exports.aliases = ["t", "tag", "ta"];
|
|
@ -6,6 +6,7 @@
|
|||
"cseID": "<PUT CUSTOM SEARCH ID HERE>",
|
||||
"dblToken": "<PUT DISCORDBOTS.ORG TOKEN HERE>",
|
||||
"botOwner": "<PUT THE USER ID OF THE BOT OWNER HERE>",
|
||||
"mongoURL": "<PUT MONGODB DATABASE URL HERE>",
|
||||
"activityMessages": [
|
||||
"<PUT WHATEVER MESSAGES YOU WANT HERE>",
|
||||
"<LIKE THIS>"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const database = require("../utils/database.js");
|
||||
const Guild = require("../utils/database.js");
|
||||
const logger = require("../utils/logger.js");
|
||||
const misc = require("../utils/misc.js");
|
||||
const client = require("../utils/client.js");
|
||||
|
@ -6,6 +6,10 @@ const client = require("../utils/client.js");
|
|||
// run when the bot is added to a guild
|
||||
module.exports = async (guild) => {
|
||||
logger.log("info", `[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${client.users.get(guild.ownerID).username}#${client.users.get(guild.ownerID).discriminator} (${guild.ownerID})`);
|
||||
database.settings.set(guild.id, misc.defaults);
|
||||
database.tags.set(guild.id, misc.tagDefaults);
|
||||
const guildDB = new Guild({
|
||||
id: guild.id,
|
||||
tags: misc.tagDefaults,
|
||||
prefix: "&"
|
||||
});
|
||||
await guildDB.save();
|
||||
};
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
const database = require("../utils/database.js");
|
||||
const logger = require("../utils/logger.js");
|
||||
|
||||
// run when the bot is removed from a guild
|
||||
module.exports = async (guild) => {
|
||||
logger.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`);
|
||||
database.settings.delete(guild.id);
|
||||
database.tags.delete(guild.id);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = async (message) => {
|
|||
|
||||
// prefix can be a mention or a set of special characters
|
||||
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
|
||||
const guildConf = database.settings.ensure(message.channel.guild.id, misc.defaults);
|
||||
const guildConf = (await database.find({ id: message.channel.guild.id }).exec())[0];
|
||||
const prefix = prefixMention.test(message.content) ? message.content.match(prefixMention)[0] : guildConf.prefix;
|
||||
|
||||
// ignore other stuff
|
||||
|
|
|
@ -7,10 +7,18 @@ const misc = require("../utils/misc.js");
|
|||
// run when ready
|
||||
module.exports = async () => {
|
||||
// make sure settings/tags exist
|
||||
client.guilds.forEach(guild => {
|
||||
database.settings.ensure(guild.id, misc.defaults);
|
||||
database.tags.ensure(guild.id, misc.tagDefaults);
|
||||
for (const guild of client.guilds) {
|
||||
const guildDB = (await database.find({ id: guild.id }).exec())[0];
|
||||
if (!guildDB) {
|
||||
console.log(`Registering database entry for ${guild.id}...`);
|
||||
const newGuild = new database({
|
||||
id: guild.id,
|
||||
tags: misc.tagDefaults,
|
||||
prefix: "&"
|
||||
});
|
||||
await newGuild.save();
|
||||
}
|
||||
}
|
||||
|
||||
// set activity (a.k.a. the gamer code)
|
||||
(async function activityChanger() {
|
||||
|
|
224
package-lock.json
generated
224
package-lock.json
generated
|
@ -24,19 +24,6 @@
|
|||
"js-tokens": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"@types/better-sqlite3": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-3.1.3.tgz",
|
||||
"integrity": "sha512-nnoebG2LgbK1WQ0dn7jtJ+RQJXcC/0G9oajJA7T+tKq2HrL9KzjMDKfe6sqkigg5HLH08WE4LRK3QDDYXPO1+w==",
|
||||
"requires": {
|
||||
"@types/integer": "*"
|
||||
}
|
||||
},
|
||||
"@types/integer": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/integer/-/integer-1.0.0.tgz",
|
||||
"integrity": "sha512-3viiRKLoSP2Qr78nMoQjkDc0fan4BgmpOyV1+1gKjE8wWXo3QQ78WItO6f9WuBf3qe3ymDYhM65oqHTOZ0rFxw=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.11.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.11.7.tgz",
|
||||
|
@ -203,48 +190,6 @@
|
|||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
|
||||
},
|
||||
"better-sqlite-pool": {
|
||||
"version": "github:eslachance/better-sqlite-pool#99b91427e4137d6aa6d3a42076880fb02b0778ac",
|
||||
"from": "github:eslachance/better-sqlite-pool",
|
||||
"requires": {
|
||||
"@types/better-sqlite3": "^3.1.3",
|
||||
"better-sqlite3": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"better-sqlite3": {
|
||||
"version": "5.4.3",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-5.4.3.tgz",
|
||||
"integrity": "sha512-fPp+8f363qQIhuhLyjI4bu657J/FfMtgiiHKfaTsj3RWDkHlWC1yT7c6kHZDnBxzQVoAINuzg553qKmZ4F1rEw==",
|
||||
"requires": {
|
||||
"integer": "^2.1.0",
|
||||
"tar": "^4.4.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"minipass": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
|
||||
"integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.13",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz",
|
||||
"integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==",
|
||||
"requires": {
|
||||
"chownr": "^1.1.1",
|
||||
"fs-minipass": "^1.2.5",
|
||||
"minipass": "^2.8.6",
|
||||
"minizlib": "^1.2.1",
|
||||
"mkdirp": "^0.5.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz",
|
||||
|
@ -296,6 +241,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
|
||||
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
|
||||
},
|
||||
"boolbase": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
|
@ -311,6 +261,11 @@
|
|||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"bson": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.1.tgz",
|
||||
"integrity": "sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg=="
|
||||
},
|
||||
"buffer-alloc": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
|
||||
|
@ -695,14 +650,6 @@
|
|||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"enmap": {
|
||||
"version": "4.8.7",
|
||||
"resolved": "https://registry.npmjs.org/enmap/-/enmap-4.8.7.tgz",
|
||||
"integrity": "sha512-uDdns7BXSohCQSFO+5RGgJQlgIgKWUHoLY0IPdXmiz90OdlfW+e2SOFAsuaXDCJxdXeKGcJJ9JUvv3wIwF80/Q==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.11"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
|
||||
|
@ -723,11 +670,18 @@
|
|||
}
|
||||
},
|
||||
"erlpack": {
|
||||
"version": "github:discordapp/erlpack#27cd243b7799a6cf3c0b6b4dcdb49084dc3e6479",
|
||||
"version": "github:discordapp/erlpack#5d0064f9e106841e1eead711a6451f99b0d289fd",
|
||||
"from": "github:discordapp/erlpack",
|
||||
"requires": {
|
||||
"bindings": "^1.2.1",
|
||||
"nan": "^2.1.0"
|
||||
"bindings": "^1.5.0",
|
||||
"nan": "^2.14.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"nan": {
|
||||
"version": "2.14.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"es6-promise": {
|
||||
|
@ -1373,11 +1327,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"integer": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/integer/-/integer-2.1.0.tgz",
|
||||
"integrity": "sha512-vBtiSgrEiNocWvvZX1RVfeOKa2mCHLZQ2p9nkQkQZ/BvEiY+6CcUz0eyjvIiewjJoeNidzg2I+tpPJvpyspL1w=="
|
||||
},
|
||||
"is-arrayish": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
|
||||
|
@ -1469,6 +1418,11 @@
|
|||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"kareem": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz",
|
||||
"integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw=="
|
||||
},
|
||||
"kuler": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/kuler/-/kuler-1.0.1.tgz",
|
||||
|
@ -1529,6 +1483,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"optional": true
|
||||
},
|
||||
"mime": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
|
||||
|
@ -1601,6 +1561,79 @@
|
|||
"resolved": "https://registry.npmjs.org/moment-duration-format/-/moment-duration-format-2.3.2.tgz",
|
||||
"integrity": "sha512-cBMXjSW+fjOb4tyaVHuaVE/A5TqkukDWiOfxxAjY+PEqmmBQlLwn+8OzwPiG3brouXKY5Un4pBjAeB6UToXHaQ=="
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.3.3.tgz",
|
||||
"integrity": "sha512-MdRnoOjstmnrKJsK8PY0PjP6fyF/SBS4R8coxmhsfEU7tQ46/J6j+aSHF2n4c2/H8B+Hc/Klbfp8vggZfI0mmA==",
|
||||
"requires": {
|
||||
"bson": "^1.1.1",
|
||||
"require_optional": "^1.0.1",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"saslprep": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"mongoose": {
|
||||
"version": "5.7.7",
|
||||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.7.7.tgz",
|
||||
"integrity": "sha512-FU59waB4LKBa9KOnqBUcCcMIVRc09TFo1F8nMxrzSiIWATaJpjxxSSH5FBVUDxQfNdJLfg9uFHxaTxhhwjsZOQ==",
|
||||
"requires": {
|
||||
"bson": "~1.1.1",
|
||||
"kareem": "2.3.1",
|
||||
"mongodb": "3.3.3",
|
||||
"mongoose-legacy-pluralize": "1.0.2",
|
||||
"mpath": "0.6.0",
|
||||
"mquery": "3.2.2",
|
||||
"ms": "2.1.2",
|
||||
"regexp-clone": "1.0.0",
|
||||
"safe-buffer": "5.1.2",
|
||||
"sift": "7.0.1",
|
||||
"sliced": "1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"mongoose-legacy-pluralize": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz",
|
||||
"integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ=="
|
||||
},
|
||||
"mpath": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.6.0.tgz",
|
||||
"integrity": "sha512-i75qh79MJ5Xo/sbhxrDrPSEG0H/mr1kcZXJ8dH6URU5jD/knFxCVqVC/gVSW7GIXL/9hHWlT9haLbCXWOll3qw=="
|
||||
},
|
||||
"mquery": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.2.tgz",
|
||||
"integrity": "sha512-XB52992COp0KP230I3qloVUbkLUxJIu328HBP2t2EsxSFtf4W1HPSOBWOXf1bqxK4Xbb66lfMJ+Bpfd9/yZE1Q==",
|
||||
"requires": {
|
||||
"bluebird": "3.5.1",
|
||||
"debug": "3.1.0",
|
||||
"regexp-clone": "^1.0.0",
|
||||
"safe-buffer": "5.1.2",
|
||||
"sliced": "1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
|
||||
|
@ -2043,6 +2076,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"regexp-clone": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz",
|
||||
"integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw=="
|
||||
},
|
||||
"regexpp": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
|
||||
|
@ -2059,6 +2097,22 @@
|
|||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
||||
},
|
||||
"require_optional": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
|
||||
"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
|
||||
"requires": {
|
||||
"resolve-from": "^2.0.0",
|
||||
"semver": "^5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"resolve-from": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz",
|
||||
"integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
|
||||
}
|
||||
}
|
||||
},
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
|
@ -2122,6 +2176,15 @@
|
|||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"dev": true
|
||||
},
|
||||
"saslprep": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
|
@ -2180,6 +2243,11 @@
|
|||
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
|
||||
"dev": true
|
||||
},
|
||||
"sift": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz",
|
||||
"integrity": "sha512-oqD7PMJ+uO6jV9EQCl0LrRw1OwsiPsiFQR5AR30heR+4Dl7jBBbDLnNvWiak20tzZlSE1H7RB30SX/1j/YYT7g=="
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
|
@ -2219,6 +2287,20 @@
|
|||
"is-fullwidth-code-point": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"sliced": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
|
||||
"integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
|
||||
},
|
||||
"sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
|
||||
},
|
||||
"dependencies": {
|
||||
"better-sqlite-pool": "github:eslachance/better-sqlite-pool",
|
||||
"bufferutil": "^4.0.1",
|
||||
"cowsay": "^1.4.0",
|
||||
"dblapi.js": "^2.3.0",
|
||||
"enmap": "^4.8.5",
|
||||
"eris": "github:abalabahaha/eris#dev",
|
||||
"erlpack": "github:discordapp/erlpack",
|
||||
"eventemitter3": "^3.1.2",
|
||||
|
@ -30,6 +28,7 @@
|
|||
"jsqr": "^1.2.0",
|
||||
"moment": "^2.24.0",
|
||||
"moment-duration-format": "^2.3.2",
|
||||
"mongoose": "^5.7.7",
|
||||
"node-fetch": "^2.6.0",
|
||||
"node-opus": "^0.3.3",
|
||||
"qrcode": "^1.4.2",
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
// database stuff
|
||||
const Enmap = require("enmap");
|
||||
const settings = new Enmap({ name: "settings" });
|
||||
exports.settings = settings;
|
||||
const tags = new Enmap({ name: "tags" });
|
||||
exports.tags = tags;
|
||||
const mongoose = require("mongoose");
|
||||
const config = require("../config.json");
|
||||
mongoose.connect(config.mongoURL);
|
||||
const guildSchema = new mongoose.Schema({
|
||||
id: String,
|
||||
tags: Map,
|
||||
prefix: String
|
||||
});
|
||||
const Guild = mongoose.model("Guild", guildSchema);
|
||||
module.exports = Guild;
|
Loading…
Reference in a new issue