New blacklist format
parent
219ecfaab5
commit
d835982972
@ -0,0 +1,18 @@
|
||||
const { Inhibitor } = require('discord-akairo');
|
||||
const Blacklists = require('../../models').Blacklists;
|
||||
|
||||
class commandblacklistInhibitor extends Inhibitor {
|
||||
constructor() {
|
||||
super('commandblacklist', {
|
||||
reason: 'commandblacklist'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, command) {
|
||||
const blacklist = await Blacklists.findOne({where: {type:command.id, uid:message.author.id}});
|
||||
|
||||
if (blacklist) return true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = commandblacklistInhibitor;
|
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('Blacklists', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
type: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
uid: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
reason: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('Blacklists');
|
||||
}
|
||||
};
|
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('commandblockusers', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
serverID: {
|
||||
type: Sequelize.BIGINT
|
||||
},
|
||||
userID: {
|
||||
type: Sequelize.BIGINT
|
||||
},
|
||||
command: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('commandblockusers');
|
||||
}
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
const {
|
||||
Model
|
||||
} = require('sequelize');
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class Blacklists extends Model {
|
||||
/**
|
||||
* Helper method for defining associations.
|
||||
* This method is not a part of Sequelize lifecycle.
|
||||
* The `models/index` file will call this method automatically.
|
||||
*/
|
||||
static associate(models) {
|
||||
// define association here
|
||||
}
|
||||
};
|
||||
Blacklists.init({
|
||||
type: DataTypes.STRING,
|
||||
uid: DataTypes.STRING,
|
||||
reason: DataTypes.STRING
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'Blacklists',
|
||||
});
|
||||
return Blacklists;
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
const {
|
||||
Model
|
||||
} = require('sequelize');
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class commandblockuser extends Model {
|
||||
/**
|
||||
* Helper method for defining associations.
|
||||
* This method is not a part of Sequelize lifecycle.
|
||||
* The `models/index` file will call this method automatically.
|
||||
*/
|
||||
static associate(models) {
|
||||
// define association here
|
||||
}
|
||||
};
|
||||
commandblockuser.init({
|
||||
serverID: DataTypes.BIGINT,
|
||||
userID: DataTypes.BIGINT,
|
||||
command: DataTypes.STRING
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'commandblockuser',
|
||||
});
|
||||
return commandblockuser;
|
||||
};
|
Loading…
Reference in New Issue