Update .gitignore. Add database related models, data.
This commit is contained in:
parent
32d0a48277
commit
dce4394ff6
|
@ -1 +1,2 @@
|
|||
node_modules/
|
||||
node_modules
|
||||
config.js
|
||||
|
|
5
bot.js
5
bot.js
|
@ -0,0 +1,5 @@
|
|||
const Telegraf = require("telegraf");
|
||||
const config = require("./config");
|
||||
const Sequelize = require("sequelize");
|
||||
|
||||
const bot = new Telegraf(config.botApiKey);
|
|
@ -0,0 +1,8 @@
|
|||
const Sequelize = require("sequelize");
|
||||
const config = require("../config");
|
||||
|
||||
const { database, username, password, options } = config.sequelize;
|
||||
const sequelize = new Sequelize(database, username, password, options);
|
||||
const models = require("../models")(sequelize);
|
||||
|
||||
module.exports = sequelize.sync().then(() => models);
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = sequelize => ({
|
||||
integrations: require("./integrations")(sequelize),
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
const Sequelize = require("sequelize");
|
||||
module.exports = sequelize => {
|
||||
const integrations = sequelize.define("integrations", {
|
||||
chatID: { type: Sequelize.INTEGER, allowNull: false, unique: "com"},
|
||||
repoURL: {type: Sequelize.STRING, allowNull: false, unique: "com"},
|
||||
chatType: {type: Sequelize.STRING},
|
||||
issues: {type: Sequelize.BOOLEAN, defaultValue: false},
|
||||
pullRequests: {type: Sequelize.BOOLEAN, defaultValue: false},
|
||||
commits: {type: Sequelize.BOOLEAN, defaultValue: true},
|
||||
});
|
||||
integrations.sync().then(return integration);
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
module.exports = {
|
||||
// Create a new bot by messaging @BotFather and follow the instructions
|
||||
// Replace the key by the actual token recieved from BotFather
|
||||
botApiKey: "key",
|
||||
|
||||
// Connection information for database
|
||||
"sequelize": {
|
||||
database: "git-alerts-bot",
|
||||
username: "git-bot",
|
||||
password: "hopefully_a_secure_password",
|
||||
options: {
|
||||
host: "localhost",
|
||||
dialect: "sqlite",
|
||||
// SQLite only
|
||||
storage: "./git-alerts-bot.sqlite"
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue