forked from Supositware/Haha-Yes
Merge branch 'master' of https://gitlab.com/loicbersier/discordbot
This commit is contained in:
commit
af3762b90d
12 changed files with 193 additions and 50 deletions
|
@ -13,10 +13,6 @@ class autoresponseCommand extends Command {
|
||||||
prompt: {
|
prompt: {
|
||||||
start: 'Do you want to **enable** or **disable** auto response?',
|
start: 'Do you want to **enable** or **disable** auto response?',
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'all',
|
|
||||||
type: 'string'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
clientPermissions: ['SEND_MESSAGES'],
|
clientPermissions: ['SEND_MESSAGES'],
|
||||||
|
@ -24,8 +20,8 @@ class autoresponseCommand extends Command {
|
||||||
channelRestriction: 'guild',
|
channelRestriction: 'guild',
|
||||||
description: {
|
description: {
|
||||||
content: 'enable/disable autoresponse',
|
content: 'enable/disable autoresponse',
|
||||||
usage: '[enable/disable] (optional) [all]',
|
usage: '[enable/disable]',
|
||||||
examples: ['enable all']
|
examples: ['enable']
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
45
commands/admin/quotation.js
Normal file
45
commands/admin/quotation.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const { Command } = require('discord-akairo');
|
||||||
|
const quotationStat = require('../../models').quotationStat;
|
||||||
|
|
||||||
|
class quotationCommand extends Command {
|
||||||
|
constructor() {
|
||||||
|
super('quotation', {
|
||||||
|
aliases: ['quotation'],
|
||||||
|
category: 'admin',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
id: 'stat',
|
||||||
|
type: 'string',
|
||||||
|
prompt: {
|
||||||
|
start: 'Do you want to **enable** or **disable** quotation?',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
clientPermissions: ['SEND_MESSAGES'],
|
||||||
|
userPermissions: ['MANAGE_MESSAGES'],
|
||||||
|
channelRestriction: 'guild',
|
||||||
|
description: {
|
||||||
|
content: 'enable/disable quotation',
|
||||||
|
usage: '[enable/disable]',
|
||||||
|
examples: ['enable']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async exec(message, args) {
|
||||||
|
if (args.stat.toLowerCase() == 'enable' || args.stat.toLowerCase() == 'disable') {
|
||||||
|
const quotationstat = await quotationStat.findOne({where: {serverID: message.guild.id}});
|
||||||
|
|
||||||
|
if (!quotationstat) {
|
||||||
|
const body = {serverID: message.guild.id, stat: args.stat};
|
||||||
|
quotationStat.create(body);
|
||||||
|
return message.channel.send(`Quotation has been ${args.stat}d`);
|
||||||
|
} else {
|
||||||
|
const body = {serverID: message.guild.id, stat: args.stat};
|
||||||
|
quotationStat.update(body, {where: {serverID: message.guild.id}});
|
||||||
|
return message.channel.send(`Quotation has been ${args.stat}d`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = quotationCommand;
|
|
@ -11,15 +11,15 @@ class audio2imageCommand extends Command {
|
||||||
category: 'fun',
|
category: 'fun',
|
||||||
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
||||||
args: [
|
args: [
|
||||||
{
|
|
||||||
id: 'link',
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'video_size',
|
id: 'video_size',
|
||||||
match: 'option',
|
match: 'option',
|
||||||
flag: '--size',
|
flag: '--size',
|
||||||
default: '640x480'
|
default: '640x480'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'link',
|
||||||
|
type: 'string',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
description: {
|
description: {
|
||||||
|
|
|
@ -88,6 +88,8 @@ class DownloadCommand extends Command {
|
||||||
fs.renameSync(`${os.tmpdir()}/${fileName}`, `${os.tmpdir()}/${fileName}.${ext}`);
|
fs.renameSync(`${os.tmpdir()}/${fileName}`, `${os.tmpdir()}/${fileName}.${ext}`);
|
||||||
} else if (fs.existsSync(`${os.tmpdir()}/${fileName}.mkv`)) { // If it can't find the video assume it got merged and end with mkv
|
} else if (fs.existsSync(`${os.tmpdir()}/${fileName}.mkv`)) { // If it can't find the video assume it got merged and end with mkv
|
||||||
fs.renameSync(`${os.tmpdir()}/${fileName}.mkv`, `${os.tmpdir()}/${fileName}.mp4`); // Discord play mkv just fine but it need to end with mp4
|
fs.renameSync(`${os.tmpdir()}/${fileName}.mkv`, `${os.tmpdir()}/${fileName}.mp4`); // Discord play mkv just fine but it need to end with mp4
|
||||||
|
} else if (fs.existsSync(`${os.tmpdir()}/${fileName}.webm`)) { // Same as mkv
|
||||||
|
ext = 'webm';
|
||||||
}
|
}
|
||||||
|
|
||||||
let file = fs.statSync(`${os.tmpdir()}/${fileName}.${ext}`);
|
let file = fs.statSync(`${os.tmpdir()}/${fileName}.${ext}`);
|
||||||
|
|
|
@ -30,8 +30,6 @@ class userInfoCommand extends Command {
|
||||||
|
|
||||||
let member = message.guild.member(user);
|
let member = message.guild.member(user);
|
||||||
|
|
||||||
console.log(member);
|
|
||||||
|
|
||||||
const Embed = this.client.util.embed()
|
const Embed = this.client.util.embed()
|
||||||
.setColor(member.displayHexColor)
|
.setColor(member.displayHexColor)
|
||||||
.setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL())
|
.setAuthor(`${user.tag} (${user.id})`, user.displayAvatarURL())
|
||||||
|
@ -47,8 +45,11 @@ class userInfoCommand extends Command {
|
||||||
Embed.addField('', '');
|
Embed.addField('', '');
|
||||||
|
|
||||||
// Show user status
|
// Show user status
|
||||||
if (user.presence.activity) Embed.addField('Presence', user.presence.activities[0], true);
|
if (user.presence.activities[0]) {
|
||||||
|
Embed.addField('Presence', user.presence.activities[0], true);
|
||||||
|
if (user.presence.activities[0].details) Embed.addField('', user.presence.activities[0].details, true);
|
||||||
|
if (user.presence.activities[0].state) Embed.addField('', user.presence.activities[0].state, true);
|
||||||
|
}
|
||||||
// Is the user a bot?
|
// Is the user a bot?
|
||||||
if (user.bot) Embed.addField('Is a bot?', '✅', true);
|
if (user.bot) Embed.addField('Is a bot?', '✅', true);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class guildCreateListener extends Listener {
|
||||||
async exec(guild) {
|
async exec(guild) {
|
||||||
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
|
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}`);
|
||||||
const channel = this.client.channels.resolve(statsChannel);
|
const channel = this.client.channels.resolve(statsChannel);
|
||||||
|
let botCount = guild.members.cache.filter(member => member.user.bot).size;
|
||||||
const addEmbed = this.client.util.embed()
|
const addEmbed = this.client.util.embed()
|
||||||
.setColor('#52e80d')
|
.setColor('#52e80d')
|
||||||
.setTitle('New boiz in town')
|
.setTitle('New boiz in town')
|
||||||
|
@ -21,8 +22,8 @@ class guildCreateListener extends Listener {
|
||||||
.addField('Guild name', guild.name, true)
|
.addField('Guild name', guild.name, true)
|
||||||
.addField('Guild ID', guild.id, true)
|
.addField('Guild ID', guild.id, true)
|
||||||
.addField('Total number of members', guild.memberCount, true)
|
.addField('Total number of members', guild.memberCount, true)
|
||||||
.addField('Number of users', guild.members.filter(member => !member.user.bot).size, true)
|
.addField('Number of users', guild.memberCount - botCount, true)
|
||||||
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true)
|
.addField('Number of bots', botCount, true)
|
||||||
.addField('Owner', guild.owner.user.username, true)
|
.addField('Owner', guild.owner.user.username, true)
|
||||||
.addField('Owner ID', guild.owner.id, true)
|
.addField('Owner ID', guild.owner.id, true)
|
||||||
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
||||||
|
|
|
@ -14,6 +14,8 @@ class guildCreateListener extends Listener {
|
||||||
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`);
|
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guild.owner.user.username}\nOwner ID: ${guild.owner}\n***BOT KICKED***`);
|
||||||
const channel = this.client.channels.resolve(statsChannel);
|
const channel = this.client.channels.resolve(statsChannel);
|
||||||
|
|
||||||
|
let botCount = guild.members.cache.filter(member => member.user.bot).size;
|
||||||
|
|
||||||
const kickEmbed = this.client.util.embed()
|
const kickEmbed = this.client.util.embed()
|
||||||
.setColor('#FF0000')
|
.setColor('#FF0000')
|
||||||
.setTitle('Some mofo just removed me from there guild :(')
|
.setTitle('Some mofo just removed me from there guild :(')
|
||||||
|
@ -22,8 +24,8 @@ class guildCreateListener extends Listener {
|
||||||
.addField('Guild name', guild.name, true)
|
.addField('Guild name', guild.name, true)
|
||||||
.addField('Guild ID', guild.id, true)
|
.addField('Guild ID', guild.id, true)
|
||||||
.addField('Total number of members', guild.memberCount, true)
|
.addField('Total number of members', guild.memberCount, true)
|
||||||
.addField('Number of users', guild.members.filter(member => !member.user.bot).size, true)
|
.addField('Number of users', guild.memberCount - botCount, true)
|
||||||
.addField('Number of bots', guild.members.filter(member => member.user.bot).size, true)
|
.addField('Number of bots', botCount, true)
|
||||||
.addField('Owner', guild.owner.user.username, true)
|
.addField('Owner', guild.owner.user.username, true)
|
||||||
.addField('Owner ID', guild.owner.id, true)
|
.addField('Owner ID', guild.owner.id, true)
|
||||||
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
||||||
|
|
|
@ -10,13 +10,13 @@ class guildMemberAddListener extends Listener {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(guild) {
|
async exec(member) {
|
||||||
if (guild.guild.id == 240843640375607296) {
|
if (member.guild.id == 240843640375607296) {
|
||||||
guild.setNickname('fart piss');
|
member.setNickname('fart piss');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const join = await joinChannel.findOne({where: {guildID: guild.guild.id}});
|
const join = await joinChannel.findOne({where: {guildID: member.guild.id}});
|
||||||
|
|
||||||
if (join) {
|
if (join) {
|
||||||
const channel = this.client.channels.resolve(join.get('channelID'));
|
const channel = this.client.channels.resolve(join.get('channelID'));
|
||||||
|
@ -26,17 +26,18 @@ class guildMemberAddListener extends Listener {
|
||||||
let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g);
|
let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g);
|
||||||
|
|
||||||
|
|
||||||
let username = guild.user.username;
|
let username = member.user.username;
|
||||||
let user = guild.user;
|
let user = member.user;
|
||||||
if (username.match(invite)) {
|
if (username.match(invite)) {
|
||||||
username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]');
|
username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]');
|
||||||
user = username;
|
user = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
welcomeMessage = welcomeMessage.replace(/\[member\]/, username);
|
welcomeMessage = welcomeMessage.replace(/\[member\]/g, username);
|
||||||
welcomeMessage = welcomeMessage.replace(/\[memberPing\]/, user);
|
welcomeMessage = welcomeMessage.replace(/\[memberPing\]/g, user);
|
||||||
welcomeMessage = welcomeMessage.replace(/\[server\]/, guild.guild.name);
|
welcomeMessage = welcomeMessage.replace(/\[server\]/g, member.guild.name);
|
||||||
|
|
||||||
|
// add attachment
|
||||||
let attach;
|
let attach;
|
||||||
if (welcomeMessage.includes('[attach:')) {
|
if (welcomeMessage.includes('[attach:')) {
|
||||||
attach = welcomeMessage.split(/(\[attach:.*?])/);
|
attach = welcomeMessage.split(/(\[attach:.*?])/);
|
||||||
|
|
|
@ -10,8 +10,8 @@ class guildMemberRemoveListener extends Listener {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(guild) {
|
async exec(member) {
|
||||||
const leave = await leaveChannel.findOne({where: {guildID: guild.guild.id}});
|
const leave = await leaveChannel.findOne({where: {guildID: member.guild.id}});
|
||||||
if (leave) {
|
if (leave) {
|
||||||
const channel = this.client.channels.resolve(leave.get('channelID'));
|
const channel = this.client.channels.resolve(leave.get('channelID'));
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ class guildMemberRemoveListener extends Listener {
|
||||||
|
|
||||||
let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g);
|
let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g);
|
||||||
|
|
||||||
let username = guild.user.username;
|
let username = member.user.username;
|
||||||
let user = guild.user;
|
let user = member.user;
|
||||||
if (username.match(invite)) {
|
if (username.match(invite)) {
|
||||||
username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]');
|
username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]');
|
||||||
user = username;
|
user = username;
|
||||||
|
@ -28,7 +28,7 @@ class guildMemberRemoveListener extends Listener {
|
||||||
|
|
||||||
byeMessage = byeMessage.replace(/\[member\]/, username);
|
byeMessage = byeMessage.replace(/\[member\]/, username);
|
||||||
byeMessage = byeMessage.replace(/\[memberPing\]/, user);
|
byeMessage = byeMessage.replace(/\[memberPing\]/, user);
|
||||||
byeMessage = byeMessage.replace(/\[server\]/, guild.guild.name);
|
byeMessage = byeMessage.replace(/\[server\]/, member.guild.name);
|
||||||
|
|
||||||
let attach;
|
let attach;
|
||||||
if (byeMessage.includes('[attach:')) {
|
if (byeMessage.includes('[attach:')) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ const autoResponse = require('../../models').autoresponse;
|
||||||
const autoResponseStat = require('../../models').autoresponseStat;
|
const autoResponseStat = require('../../models').autoresponseStat;
|
||||||
const BannedWords = require('../../models').bannedWords;
|
const BannedWords = require('../../models').bannedWords;
|
||||||
const WhitelistWord = require('../../models').whitelistWord;
|
const WhitelistWord = require('../../models').whitelistWord;
|
||||||
|
const quotationStat = require('../../models').quotationStat;
|
||||||
|
|
||||||
class messageListener extends Listener {
|
class messageListener extends Listener {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -25,6 +26,11 @@ class messageListener extends Listener {
|
||||||
|
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
|
/* Banned words section
|
||||||
|
*
|
||||||
|
* This section contains code about the banned words features
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
// Banned words
|
// Banned words
|
||||||
const bannedWords = await BannedWords.findAll({where: {word: Sequelize.where(Sequelize.fn('LOCATE', Sequelize.col('word'), message.content.replace(/\u200B/g, '').replace(/[\u0250-\ue007]/g, '')), Sequelize.Op.ne, 0), serverID: message.guild.id}});
|
const bannedWords = await BannedWords.findAll({where: {word: Sequelize.where(Sequelize.fn('LOCATE', Sequelize.col('word'), message.content.replace(/\u200B/g, '').replace(/[\u0250-\ue007]/g, '')), Sequelize.Op.ne, 0), serverID: message.guild.id}});
|
||||||
|
@ -55,8 +61,14 @@ class messageListener extends Listener {
|
||||||
return message.delete({reason: `Deleted message: ${message.content}`});
|
return message.delete({reason: `Deleted message: ${message.content}`});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
/* Autoresponse feature & tag
|
||||||
|
*
|
||||||
|
* This section contains autoresponse and tag feature
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
// auto responses
|
// auto responses
|
||||||
const autoresponseStat = await autoResponseStat.findOne({where: {serverID: message.guild.id}});
|
const autoresponseStat = await autoResponseStat.findOne({where: {serverID: message.guild.id, stat: 'enable'}});
|
||||||
if (autoresponseStat) {
|
if (autoresponseStat) {
|
||||||
// Infinit haha very yes
|
// Infinit haha very yes
|
||||||
if (message.content.toLowerCase().startsWith('haha very') && message.content.toLowerCase().endsWith('yes')) {
|
if (message.content.toLowerCase().startsWith('haha very') && message.content.toLowerCase().endsWith('yes')) {
|
||||||
|
@ -68,8 +80,6 @@ class messageListener extends Listener {
|
||||||
return message.channel.send('haha very yes');
|
return message.channel.send('haha very yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If autoresponse is enable send the response
|
|
||||||
if (autoresponseStat.get('stat') == 'enable' && autoresponseStat.get('serverID') == message.guild.id) {
|
|
||||||
// Reply with images as attachement
|
// Reply with images as attachement
|
||||||
const autoresponse = await autoResponse.findOne({where: {trigger: message.content.toLowerCase()}});
|
const autoresponse = await autoResponse.findOne({where: {trigger: message.content.toLowerCase()}});
|
||||||
|
|
||||||
|
@ -87,9 +97,8 @@ class messageListener extends Listener {
|
||||||
return message.channel.send({files: [content]});
|
return message.channel.send({files: [content]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// User autoresponse
|
// User autoresponse
|
||||||
const tag = await Tag.findOne({where: {trigger: message.content.toLowerCase(), serverID: message.guild.id}});
|
const tag = await Tag.findOne({where: {trigger: message.content.toLowerCase(), serverID: message.guild.id}});
|
||||||
if (tag) {
|
if (tag) {
|
||||||
|
@ -222,6 +231,51 @@ class messageListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quotation feature
|
||||||
|
*
|
||||||
|
* This section will contain the code for the quotation feature, it will detect link for it and send it as embed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const quotationstat = await quotationStat.findOne({where: {serverID: message.guild.id, stat: 'enable'}});
|
||||||
|
|
||||||
|
if (quotationstat && message.content.includes('discordapp.com/channels/')) {
|
||||||
|
let url = message.content.split('/');
|
||||||
|
let guildID = url[4];
|
||||||
|
let channelID = url[5];
|
||||||
|
let messageID = url[6];
|
||||||
|
|
||||||
|
|
||||||
|
// Verify if the guild, channel and message exist
|
||||||
|
let guild = this.client.guilds.resolve(guildID);
|
||||||
|
if (!guild) return;
|
||||||
|
let channel = this.client.channels.resolve(channelID);
|
||||||
|
if (!channel) return;
|
||||||
|
let quote = await channel.messages.fetch(messageID)
|
||||||
|
.catch(() => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
if (!quote) return;
|
||||||
|
|
||||||
|
let Embed = this.client.util.embed()
|
||||||
|
.setAuthor(quote.author.username, quote.author.displayAvatarURL())
|
||||||
|
.addField('Jump to', `[message](https://discordapp.com/channels/${message.guild.id}/${channelID}/${messageID})`, true)
|
||||||
|
.addField('In channel', quote.channel.name, true)
|
||||||
|
.addField('Quoted by', message.author, true)
|
||||||
|
.setDescription(quote.content)
|
||||||
|
.setTimestamp(quote.createdTimestamp);
|
||||||
|
|
||||||
|
if (quote.member) Embed.setColor(quote.member.displayHexColor);
|
||||||
|
|
||||||
|
if (guild.id != message.guild.id) Embed.addField('In guild', guild.name, true);
|
||||||
|
let Attachment = (quote.attachments).array();
|
||||||
|
if (Attachment[0]) Embed.setImage(Attachment[0].url);
|
||||||
|
|
||||||
|
return message.channel.send(Embed)
|
||||||
|
.then(() => {
|
||||||
|
message.delete();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
30
migrations/20200305204757-create-quotation-stat.js
Normal file
30
migrations/20200305204757-create-quotation-stat.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.createTable('quotationStats', {
|
||||||
|
id: {
|
||||||
|
allowNull: false,
|
||||||
|
autoIncrement: true,
|
||||||
|
primaryKey: true,
|
||||||
|
type: Sequelize.INTEGER
|
||||||
|
},
|
||||||
|
serverID: {
|
||||||
|
type: Sequelize.BIGINT
|
||||||
|
},
|
||||||
|
stat: {
|
||||||
|
type: Sequelize.STRING
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
allowNull: false,
|
||||||
|
type: Sequelize.DATE
|
||||||
|
},
|
||||||
|
updatedAt: {
|
||||||
|
allowNull: false,
|
||||||
|
type: Sequelize.DATE
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.dropTable('quotationStats');
|
||||||
|
}
|
||||||
|
};
|
11
models/quotationstat.js
Normal file
11
models/quotationstat.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
const quotationStat = sequelize.define('quotationStat', {
|
||||||
|
serverID: DataTypes.BIGINT,
|
||||||
|
stat: DataTypes.STRING
|
||||||
|
}, {});
|
||||||
|
quotationStat.associate = function(models) {
|
||||||
|
// associations can be defined here
|
||||||
|
};
|
||||||
|
return quotationStat;
|
||||||
|
};
|
Loading…
Reference in a new issue