Migrated database to PostgreSQL, updated packages
This commit is contained in:
parent
0760136ded
commit
2a67b76169
15 changed files with 362 additions and 570 deletions
|
@ -1,32 +1,9 @@
|
|||
// database stuff
|
||||
const mongoose = require("mongoose");
|
||||
mongoose.connect(process.env.MONGO, { poolSize: 10, bufferMaxEntries: 0, reconnectTries: 5000, useNewUrlParser: true, useUnifiedTopology: true });
|
||||
const guildSchema = new mongoose.Schema({
|
||||
id: String,
|
||||
tags: Map,
|
||||
prefix: String,
|
||||
warns: Map,
|
||||
disabledChannels: [String]
|
||||
const { Pool } = require("pg");
|
||||
const pool = new Pool({
|
||||
user: "esmbot",
|
||||
host: "localhost",
|
||||
database: "esmbot",
|
||||
port: 5432
|
||||
});
|
||||
const Guild = mongoose.model("Guild", guildSchema);
|
||||
|
||||
const tweetSchema = new mongoose.Schema({
|
||||
tweets: [String],
|
||||
replies: [String],
|
||||
media: [String],
|
||||
phrases: [String],
|
||||
games: [String],
|
||||
characters: [String],
|
||||
download: [String],
|
||||
enabled: Boolean
|
||||
});
|
||||
const TweetCollection = mongoose.model("TweetCollection", tweetSchema);
|
||||
|
||||
const globalSchema = new mongoose.Schema({
|
||||
cmdCounts: Map
|
||||
});
|
||||
const Global = mongoose.model("Global", globalSchema);
|
||||
|
||||
exports.guilds = Guild;
|
||||
exports.tweets = TweetCollection;
|
||||
exports.global = Global;
|
||||
module.exports = pool;
|
|
@ -1,5 +1,4 @@
|
|||
const Twitter = require("node-tweet");
|
||||
const database = require("../utils/database.js");
|
||||
const client = new Twitter({
|
||||
consumerKey: process.env.TWITTER_KEY,
|
||||
consumerSecret: process.env.CONSUMER_SECRET,
|
||||
|
@ -8,7 +7,4 @@ const client = new Twitter({
|
|||
});
|
||||
exports.client = client;
|
||||
exports.active = false;
|
||||
database.tweets.find({ enabled: true }).lean().exec((error, docs) => {
|
||||
if (error) throw error;
|
||||
exports.tweets = docs[0];
|
||||
});
|
||||
exports.tweets = require("../tweets.json");
|
Loading…
Add table
Add a link
Reference in a new issue