Compare commits

..

7 commits

53 changed files with 3462 additions and 62 deletions

View file

@ -1,5 +1,11 @@
token=your.token token=YourToken
clientId=botClientId clientId=BotClientId
guildId=DevGuildId guildId=DevGuildId
uptimeURL=uptimeKumaOrWhateverStatusThingYouUseOrJustLeaveEmpty uptimeURL=UptimeKumaOrWhateverStatusThingYouUseOrJustLeaveEmpty
uptimeInterval=60 uptimeInterval=60
twiConsumer=TwitterConsumerToken
twiConsumerSecret=TwitterConsumerSecretToken
twiToken=TwitterToken
twiTokenSecret=TwitterSecretToken
twiChannel=ChannelWhereJustTheTwitterLinkAreSent
twiLogChannel=ChannelWhereTheDetailedInfoOfTheCommandIsSent

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
.env .env
node_modules/ node_modules/
bin/ bin/
config/config.json

194
commands/fun/tweet.js Normal file
View file

@ -0,0 +1,194 @@
import { SlashCommandBuilder } from '@discordjs/builders';
import { MessageEmbed } from 'discord.js';
import Twit from 'twit';
import fetch from 'node-fetch';
import os from 'node:os';
import fs from 'node:fs';
import db from '../../models/index.js';
import wordToCensor from '../../json/censor.json' assert {type: 'json'};;
import dotenv from 'dotenv';
dotenv.config();
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret, twiChannel, twiLogChannel } = process.env;
const Blacklists = db.Blacklists;
export default {
data: new SlashCommandBuilder()
.setName('tweet')
.setDescription('Send tweet from Haha yes twitter account. Please do not use it for advertisement and keep it english')
.addStringOption(option =>
option.setName('content')
.setDescription('The content of the tweet you want to send me.')
.setRequired(false))
.addAttachmentOption(option =>
option.setName('image')
.setDescription('Optional attachment (Image only.)')
.setRequired(false)),
async execute(interaction) {
await interaction.deferReply({ ephemeral: false });
const client = interaction.client;
let tweet = interaction.options.getString('content');
const attachment = interaction.options.getAttachment('image');
const date = new Date();
// If account is less than 6 months old don't accept the tweet ( alt prevention )
if (interaction.user.createdAt > date.setMonth(date.getMonth() - 6)) {
await interaction.editReply({ content: 'Your account is too new to be able to use this command!' });
return;
}
// If account is less than 1 year old don't accept attachment
if (attachment && interaction.user.createdAt > date.setFullYear(date.getFullYear() - 1)) {
await interaction.editReply({ content: 'Your account need to be 1 year or older to be able to send attachment!' });
return;
}
// remove zero width space
if (tweet) {
tweet = tweet.replace('', '');
}
if (tweet) {
// Detect banned word (Blacklist the user directly)
if (wordToCensor.includes(tweet) || wordToCensor.includes(tweet.substr(0, tweet.length - 1)) || wordToCensor.includes(tweet.substr(1, tweet.length))) {
const body = { type:'tweet', uid: interaction.user.id, reason: 'Automatic ban from banned word.' };
Blacklists.create(body);
await interaction.editReply({ content: 'Sike, you just posted cringe! Enjoy the blacklist :)' });
return;
}
// Very simple link detection
if (new RegExp('([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?').test(tweet) && !tweet.includes('twitter.com')) {
await interaction.editReply({ content: 'You may not tweet links outside of twitter.com' });
return;
}
// Do not allow discord invites
if (tweet.includes('discord.gg') || tweet.includes('discord.com/invite/')) {
await interaction.editReply({ content: 'No discord invite allowed.' });
return;
}
}
const T = new Twit({
consumer_key: twiConsumer,
consumer_secret: twiConsumerSecret,
access_token: twiToken,
access_token_secret: twiTokenSecret,
});
try {
// Make sure there is an attachment and if its an image
if (attachment) {
if (attachment.name.toLowerCase().endsWith('.jpg') || attachment.name.toLowerCase().endsWith('.png') || attachment.name.toLowerCase().endsWith('.gif')) {
fetch(attachment.url)
.then(res => {
const dest = fs.createWriteStream(`${os.tmpdir()}/${attachment.name}`);
res.body.pipe(dest);
dest.on('finish', () => {
const file = fs.statSync(`${os.tmpdir()}/${attachment.name}`);
const fileSize = file.size / 1000000.0;
if ((attachment.name.toLowerCase().endsWith('.jpg') || attachment.name.toLowerCase().endsWith('.png')) && fileSize > 5) {
return interaction.editReply({ content: 'Images can\'t be larger than 5 MB!' });
}
else if (attachment.name.toLowerCase().endsWith('.gif') && fileSize > 15) {
return interaction.editReply({ content: 'Gifs can\'t be larger than 15 MB!' });
}
const b64Image = fs.readFileSync(`${os.tmpdir()}/${attachment.name}`, { encoding: 'base64' });
T.post('media/upload', { media_data: b64Image }, function(err, data) {
if (err) {
console.log('OH NO AN ERROR!!!!!!!');
console.error(err);
return interaction.editReply({ content: 'OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue! ' });
}
else {
Tweet(data);
}
});
});
});
}
else {
await interaction.editReply({ content: 'File type not supported, you can only send jpg/png/gif' });
return;
}
}
else {
Tweet();
}
}
catch (err) {
console.error(err);
await interaction.editReply({ content: 'Oh no, an error has occurred :(' });
return;
}
function Tweet(data) {
let options = {
status: tweet,
};
if (data && tweet) {
options = {
status: tweet,
media_ids: new Array(data.media_id_string),
};
}
else if (data) {
options = {
media_ids: new Array(data.media_id_string),
};
}
T.post('statuses/update', options, function(err, response) {
if (err) {
// Rate limit exceeded
if (err.code == 88) return interaction.editReply({ content: err.interaction });
// Tweet needs to be a bit shorter.
if (err.code == 186) return interaction.editReply({ content: `${err.interaction} Your interaction was ${tweet.length} characters, you need to remove ${tweet.length - 280} characters (This count may be inaccurate if your interaction contained link)` });
// Status is a duplicate.
if (err.code == 187) return interaction.editReply({ content: err.interaction });
// To protect our users from spam and other malicious activity, this account is temporarily locked.
if (err.code == 326) return interaction.editReply({ content: err.interaction });
console.error('OH NO!!!!');
console.error(err);
return interaction.editReply({ content: 'OH NO!!! AN ERROR HAS occurred!!! please hold on while i find what\'s causing this issue!' });
}
const tweetid = response.id_str;
const FunnyWords = ['oppaGangnamStyle', '69', '420', 'cum', 'funnyMan', 'GUCCISmartToilet', 'TwitterForClowns', 'fart', 'mcDotnamejeffDotxyz', 'ok', 'hi', 'howAreYou', 'WhatsNinePlusTen', '21'];
const TweetLink = `https://twitter.com/${FunnyWords[Math.floor((Math.random() * FunnyWords.length))]}/status/${tweetid}`;
// Im too lazy for now to make an entry in config.json
let channel = interaction.client.channels.resolve(twiChannel);
channel.send(TweetLink);
const Embed = new MessageEmbed()
.setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL() })
.setDescription(tweet)
.addField('Link', TweetLink, true)
.addField('Tweet ID', tweetid, true)
.addField('Channel ID', interaction.channel.id, true)
.addField('Messsage ID', interaction.id, true)
.addField('Author', `${interaction.user.username} (${interaction.user.id})`, true)
.setTimestamp();
if (interaction.guild) {
Embed.addField('Guild', `${interaction.guild.name} (${interaction.guild.id})`, true);
Embed.addField('message link', `https://discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${interaction.id}`);
}
else {
Embed.addField('message link', `https://discord.com/channels/@me/${interaction.channel.id}/${interaction.id}`);
}
if (attachment) Embed.setImage(attachment.url);
channel = interaction.client.channels.resolve(twiLogChannel);
channel.send({ embeds: [Embed] });
return interaction.editReply({ content: `Go see ur epic tweet ${TweetLink}` });
});
}
},
};

View file

@ -49,6 +49,18 @@ const commands = [
new SlashCommandBuilder() new SlashCommandBuilder()
.setName('inspirobot') .setName('inspirobot')
.setDescription('Get an image from inspirobot'), .setDescription('Get an image from inspirobot'),
new SlashCommandBuilder()
.setName('tweet')
.setDescription('Send tweet from Haha yes twitter account. Please do not use it for advertisement and keep it english')
.addStringOption(option =>
option.setName('content')
.setDescription('The content of the tweet you want to send me.')
.setRequired(false))
.addAttachmentOption(option =>
option.setName('image')
.setDescription('Optional attachment (Image only.)')
.setRequired(false)),
] ]
.map(command => command.toJSON()); .map(command => command.toJSON());
@ -59,6 +71,11 @@ if (process.argv[2] === 'global') {
.then(() => console.log('Successfully registered application commands globally.')) .then(() => console.log('Successfully registered application commands globally.'))
.catch(console.error); .catch(console.error);
} }
else if (process.argv[2] === 'delete') {
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: [] })
.then(() => console.log('Successfully deleted all guild commands.'))
.catch(console.error);
}
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands }) rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`)) .then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`))

View file

@ -1,9 +1,19 @@
import db from '../../models/index.js';
export default { export default {
name: 'interactionCreate', name: 'interactionCreate',
async execute(interaction) { async execute(interaction) {
const client = interaction.client; const client = interaction.client;
if (!interaction.isCommand()) return; if (!interaction.isCommand()) return;
const globalBlacklist = await db.Blacklists.findOne({ where: { type:'global', uid:interaction.user.id } });
const commandBlacklist = await db.Blacklists.findOne({ where: { type:interaction.commandName, uid:interaction.user.id } });
if (globalBlacklist) {
return interaction.reply({ content: 'You are globally blacklisted.', ephemeral: true });
}
else if (commandBlacklist) {
return interaction.reply({ content: 'You are blacklisted.', ephemeral: true });
}
const command = client.commands.get(interaction.commandName); const command = client.commands.get(interaction.commandName);
console.log(`\x1b[33m${interaction.user.tag} (${interaction.user.id})\x1b[0m launched command \x1b[33m${interaction.commandName}\x1b[0m`); console.log(`\x1b[33m${interaction.user.tag} (${interaction.user.id})\x1b[0m launched command \x1b[33m${interaction.commandName}\x1b[0m`);

View file

@ -1,8 +1,6 @@
import { exec } from 'node:child_process'; import { exec } from 'node:child_process';
import https from 'node:https';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const { uptimeURL, uptimeInterval } = process.env;
export default { export default {
name: 'ready', name: 'ready',
@ -33,17 +31,5 @@ export default {
console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`); console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`);
console.log(`Running yt-dlp \x1b[33m${ytdlpVersion.replace('\n', '')}\x1b[0m`); console.log(`Running yt-dlp \x1b[33m${ytdlpVersion.replace('\n', '')}\x1b[0m`);
console.log('===========[ READY ]==========='); console.log('===========[ READY ]===========');
if (uptimeURL != '') {
pingStatus(client, 'Starting up');
setInterval(() => {
pingStatus(client, 'OK');
}, uptimeInterval * 1000);
}
}, },
}; };
async function pingStatus(client, msg) {
https.get(`${uptimeURL}msg=${msg}&ping=${Math.round(client.ws.ping)}`);
}

27
events/client/uptime.js Normal file
View file

@ -0,0 +1,27 @@
import https from 'node:https';
import dotenv from 'dotenv';
dotenv.config();
const { uptimeURL, uptimeInterval } = process.env;
export default {
name: 'ready',
once: true,
async execute(client) {
if (uptimeURL != '') {
const interval = uptimeInterval ? uptimeInterval : 60;
console.log(`Sending uptime to ${uptimeURL} every ${interval} seconds.`);
pingStatus(client, 'Starting', 'Starting up');
setInterval(() => {
pingStatus(client, 'up', 'OK');
}, interval * 1000);
}
else {
console.error('No uptime url set up.');
}
},
};
async function pingStatus(client, status, msg) {
https.get(`${uptimeURL}?status=${status}&msg=${msg}&ping=${Math.round(client.ws.ping)}`);
}

1
json/censor.json Normal file
View file

@ -0,0 +1 @@
["1488","14/88","14 88","niggar", "nigger","nigar", "kys", "kill yourself", "faggot", "fag", "kill ur self","n\ni\ng\ng\ne\nr","n i g g e r","we must secure the existance of our people and a future for white children."]

View file

@ -0,0 +1,38 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Tags', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
trigger: {
type: Sequelize.TEXT,
},
response: {
type: Sequelize.TEXT,
},
ownerID: {
type: Sequelize.BIGINT,
},
serverID: {
type: Sequelize.BIGINT,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('Tags');
}
};

View file

@ -0,0 +1,35 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('autoresponses', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
trigger: {
type: Sequelize.TEXT
},
response: {
type: Sequelize.TEXT
},
type: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('autoresponses');
}
};

View file

@ -0,0 +1,32 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('autoresponseStats', {
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('autoresponseStats');
}
};

View file

@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('guessLeaderboards', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
memberID: {
type: Sequelize.BIGINT
},
try: {
type: Sequelize.INTEGER
},
difficulty: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('guessLeaderboards');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('bannedWords', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
word: {
type: Sequelize.STRING
},
serverID: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('bannedWords');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('TwitterBlacklists', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userID: {
type: Sequelize.BIGINT
},
reason: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('TwitterBlacklists');
}
};

View file

@ -0,0 +1,27 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('guildBlacklists', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
guildID: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('guildBlacklists');
}
};

View file

@ -0,0 +1,27 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('userBlacklists', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userID: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('userBlacklists');
}
};

View file

@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('borgars', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userID: {
type: Sequelize.BIGINT
},
level: {
type: Sequelize.INTEGER
},
xp: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('borgars');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('donators', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userID: {
type: Sequelize.BIGINT
},
comment: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('donators');
}
};

View file

@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('joinChannels', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
channelID: {
type: Sequelize.BIGINT
},
guildID: {
type: Sequelize.BIGINT
},
message: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('joinChannels');
}
};

View file

@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('leaveChannels', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
channelID: {
type: Sequelize.BIGINT
},
guildID: {
type: Sequelize.BIGINT
},
message: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('leaveChannels');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('whitelistWords', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
word: {
type: Sequelize.STRING
},
serverID: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('whitelistWords');
}
};

View 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');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('commandBlocks', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
serverID: {
type: Sequelize.BIGINT
},
command: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('commandBlocks');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('LogStats', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
guild: {
type: Sequelize.BIGINT
},
channel: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('LogStats');
}
};

View file

@ -0,0 +1,33 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('ytpHashes', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
hash: {
type: Sequelize.STRING
},
link: {
type: Sequelize.STRING
},
messageID: {
type: Sequelize.BIGINT
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('ytpHashes');
}
};

View file

@ -0,0 +1,30 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('ytpblacklists', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
userID: {
type: Sequelize.BIGINT
},
reason: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('ytpblacklists');
}
};

View file

@ -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');
}
};

View file

@ -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');
}
};

3
migrations/package.json Normal file
View file

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

14
models/autoresponse.js Normal file
View file

@ -0,0 +1,14 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = (sequelize, DataTypes) => {
const autoresponse = sequelize.define('autoresponse', {
trigger: DataTypes.STRING,
response: DataTypes.STRING,
type: DataTypes.STRING
}, {});
autoresponse.associate = function(models) {
// associations can be defined here
};
return autoresponse;
};

View file

@ -0,0 +1,13 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = (sequelize, DataTypes) => {
const autoresponseStat = sequelize.define('autoresponseStat', {
serverID: DataTypes.STRING,
stat: DataTypes.STRING
}, {});
autoresponseStat.associate = function(models) {
// associations can be defined here
};
return autoresponseStat;
};

11
models/bannedwords.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const bannedWords = sequelize.define('bannedWords', {
word: DataTypes.STRING,
serverID: DataTypes.BIGINT
}, {});
bannedWords.associate = function(models) {
// associations can be defined here
};
return bannedWords;
};

25
models/blacklists.js Normal file
View file

@ -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;
};

12
models/borgar.js Normal file
View file

@ -0,0 +1,12 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const borgar = sequelize.define('borgar', {
userID: DataTypes.BIGINT,
level: DataTypes.INTEGER,
xp: DataTypes.INTEGER
}, {});
borgar.associate = function(models) {
// associations can be defined here
};
return borgar;
};

11
models/commandblock.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const commandBlock = sequelize.define('commandBlock', {
serverID: DataTypes.BIGINT,
command: DataTypes.STRING
}, {});
commandBlock.associate = function(models) {
// associations can be defined here
};
return commandBlock;
};

View file

@ -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;
};

11
models/donator.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const donator = sequelize.define('donator', {
userID: DataTypes.BIGINT,
comment: DataTypes.STRING
}, {});
donator.associate = function(models) {
// associations can be defined here
};
return donator;
};

View file

@ -0,0 +1,12 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const guessLeaderboard = sequelize.define('guessLeaderboard', {
memberID: DataTypes.INTEGER,
try: DataTypes.INTEGER,
difficulty: DataTypes.STRING
}, {});
guessLeaderboard.associate = function(models) {
// associations can be defined here
};
return guessLeaderboard;
};

10
models/guildblacklist.js Normal file
View file

@ -0,0 +1,10 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const guildBlacklist = sequelize.define('guildBlacklist', {
guildID: DataTypes.BIGINT
}, {});
guildBlacklist.associate = function(models) {
// associations can be defined here
};
return guildBlacklist;
};

37
models/index.js Normal file
View file

@ -0,0 +1,37 @@
'use strict';
const fs = require('fs');
const path = require('path');
const Sequelize = require('sequelize');
const basename = path.basename(__filename);
const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../config/config.json')[env];
const db = {};
let sequelize;
if (config.use_env_variable) {
sequelize = new Sequelize(process.env[config.use_env_variable], config);
} else {
sequelize = new Sequelize(config.database, config.username, config.password, config);
}
fs
.readdirSync(__dirname)
.filter(file => {
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
})
.forEach(file => {
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
db[model.name] = model;
});
Object.keys(db).forEach(modelName => {
if (db[modelName].associate) {
db[modelName].associate(db);
}
});
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;

12
models/joinchannel.js Normal file
View file

@ -0,0 +1,12 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const joinChannel = sequelize.define('joinChannel', {
channelID: DataTypes.BIGINT,
guildID: DataTypes.BIGINT,
message: DataTypes.STRING
}, {});
joinChannel.associate = function(models) {
// associations can be defined here
};
return joinChannel;
};

12
models/leavechannel.js Normal file
View file

@ -0,0 +1,12 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const leaveChannel = sequelize.define('leaveChannel', {
channelID: DataTypes.BIGINT,
guildID: DataTypes.BIGINT,
message: DataTypes.STRING
}, {});
leaveChannel.associate = function(models) {
// associations can be defined here
};
return leaveChannel;
};

11
models/logstats.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const LogStats = sequelize.define('LogStats', {
guild: DataTypes.BIGINT,
channel: DataTypes.BIGINT
}, {});
LogStats.associate = function(models) {
// associations can be defined here
};
return LogStats;
};

3
models/package.json Normal file
View file

@ -0,0 +1,3 @@
{
"type": "commonjs"
}

11
models/quotationstat.js Normal file
View 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;
};

15
models/tag.js Normal file
View file

@ -0,0 +1,15 @@
/* eslint-disable no-unused-vars */
/* eslint-disable indent */
'use strict';
module.exports = (sequelize, DataTypes) => {
const Tag = sequelize.define('Tag', {
trigger: DataTypes.STRING,
response: DataTypes.STRING,
ownerID: DataTypes.BIGINT,
serverID: DataTypes.BIGINT
}, {});
Tag.associate = function(models) {
// associations can be defined here
};
return Tag;
};

View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const TwitterBlacklist = sequelize.define('TwitterBlacklist', {
userID: DataTypes.BIGINT,
reason: DataTypes.STRING
}, {});
TwitterBlacklist.associate = function(models) {
// associations can be defined here
};
return TwitterBlacklist;
};

10
models/userblacklist.js Normal file
View file

@ -0,0 +1,10 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const userBlacklist = sequelize.define('userBlacklist', {
userID: DataTypes.BIGINT
}, {});
userBlacklist.associate = function(models) {
// associations can be defined here
};
return userBlacklist;
};

11
models/whitelistword.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const whitelistWord = sequelize.define('whitelistWord', {
word: DataTypes.STRING,
serverID: DataTypes.BIGINT
}, {});
whitelistWord.associate = function(models) {
// associations can be defined here
};
return whitelistWord;
};

11
models/ytpblacklist.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const ytpblacklist = sequelize.define('ytpblacklist', {
userID: DataTypes.BIGINT,
reason: DataTypes.STRING
}, {});
ytpblacklist.associate = function(models) {
// associations can be defined here
};
return ytpblacklist;
};

11
models/ytphash.js Normal file
View file

@ -0,0 +1,11 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const ytpHash = sequelize.define('ytpHash', {
hash: DataTypes.STRING,
messageID: DataTypes.BIGINT
}, {});
ytpHash.associate = function(models) {
// associations can be defined here
};
return ytpHash;
};

2300
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -22,9 +22,15 @@
"discord-api-types": "^0.33.1", "discord-api-types": "^0.33.1",
"discord.js": "^13.7.0", "discord.js": "^13.7.0",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"node-fetch": "^3.2.6" "mariadb": "^3.0.1",
"mysql2": "^2.3.3",
"node-fetch": "^3.2.6",
"sequelize": "^6.21.3",
"twit": "^2.2.11"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.16.0" "@types/node": "^18.7.3",
"eslint": "^8.16.0",
"sequelize-cli": "^6.4.1"
} }
} }