Compare commits
No commits in common. "467d282a3ccf2ec9dfc31d1ec908ebe77f537b53" and "8f9bb6b4f85b7c5287a6f149b07f4dbe372ef500" have entirely different histories.
467d282a3c
...
8f9bb6b4f8
9 changed files with 30 additions and 42 deletions
|
@ -9,6 +9,7 @@ export default {
|
||||||
category: 'admin',
|
category: 'admin',
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
const autoresponseStat = await db.autoresponseStat.findOne({ where: { serverID: interaction.guild.id } });
|
const autoresponseStat = await db.autoresponseStat.findOne({ where: { serverID: interaction.guild.id } });
|
||||||
|
console.log(autoresponseStat);
|
||||||
if (!autoresponseStat) {
|
if (!autoresponseStat) {
|
||||||
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
const body = { serverID: interaction.guild.id, stat: 'enable' };
|
||||||
await db.autoresponseStat.create(body);
|
await db.autoresponseStat.create(body);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
|
import { EmbedBuilder } from 'discord.js';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -29,8 +29,7 @@ export default {
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
const content = args.content;
|
const content = args.content;
|
||||||
const attachment = args.image;
|
const attachment = args.image;
|
||||||
console.log(args);
|
|
||||||
console.log(attachment);
|
|
||||||
if (!content && !attachment) {
|
if (!content && !attachment) {
|
||||||
return interaction.reply({ content: 'Uh oh! You are missing any content for me to tweet!', ephemeral: true });
|
return interaction.reply({ content: 'Uh oh! You are missing any content for me to tweet!', ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ export default {
|
||||||
.setDescription('Optional attachment.')
|
.setDescription('Optional attachment.')
|
||||||
.setRequired(false)),
|
.setRequired(false)),
|
||||||
category: 'owner',
|
category: 'owner',
|
||||||
ownerOnly: true,
|
|
||||||
async execute(interaction, args, client) {
|
async execute(interaction, args, client) {
|
||||||
/* Too lazy to implement that now (Watch it rest untouched for months)
|
/* Too lazy to implement that now (Watch it rest untouched for months)
|
||||||
async function uuidv4() {
|
async function uuidv4() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { PermissionFlagsBits, InteractionType } from 'discord.js';
|
import { PermissionFlagsBits, InteractionType } from 'discord.js';
|
||||||
import db from '../../models/index.js';
|
import db from '../../models/index.js';
|
||||||
|
const ratelimit = {};
|
||||||
|
|
||||||
const { ownerId } = process.env;
|
const { ownerId } = process.env;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const ratelimit = global.ratelimit;
|
|
||||||
const client = interaction.client;
|
const client = interaction.client;
|
||||||
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
||||||
|
|
||||||
|
@ -52,31 +52,26 @@ export default {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!ratelimit[userID]) {
|
|
||||||
ratelimit[userID] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
if (ratelimit[userID][commandName]) {
|
if (ratelimit[userID]) {
|
||||||
if (ratelimit[userID][commandName].cooldown) {
|
if (ratelimit[userID].cooldown) {
|
||||||
if (date > ratelimit[userID][commandName].cooldown) {
|
if (commandName === ratelimit[userID].command && date > ratelimit[userID].cooldown) {
|
||||||
ratelimit[userID][commandName].limit = 0;
|
ratelimit[userID].limit = 0;
|
||||||
ratelimit[userID][commandName].cooldown = undefined;
|
ratelimit[userID].cooldown = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.ratelimit === ratelimit[userID][commandName].limit) {
|
if (commandName === ratelimit[userID].command && command.ratelimit === ratelimit[userID].limit) {
|
||||||
return await interaction.reply({ content: `You are being rate limited. You can try again in ${Math.floor((ratelimit[userID][commandName].cooldown - date) / 1000)} seconds.`, ephemeral: true });
|
return await interaction.reply({ content: `You are being rate limited. You can try again in ${Math.floor((ratelimit[userID].cooldown - date) / 1000)} seconds.`, ephemeral: true });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (command.ratelimit) {
|
if (command.ratelimit) {
|
||||||
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName] ? ratelimit[userID][commandName].limit + 1 : 1 };
|
ratelimit[userID] = { command: commandName, limit: ratelimit[userID] ? ratelimit[userID].limit + 1 : 1 };
|
||||||
if (command.ratelimit === ratelimit[userID][commandName].limit) {
|
if (command.ratelimit === ratelimit[userID].limit) {
|
||||||
date.setSeconds(date.getSeconds() + command.cooldown);
|
date.setSeconds(date.getSeconds() + command.cooldown);
|
||||||
|
|
||||||
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName].limit, cooldown: date };
|
ratelimit[userID] = { command: commandName, limit: ratelimit[userID].limit, cooldown: date };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
|
import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
|
||||||
import db from '../../models/index.js';
|
import db from '../../models/index.js';
|
||||||
import { rand } from '../../utils/rand.js';
|
import { rand } from '../../utils/rand.js';
|
||||||
|
const ratelimit = {};
|
||||||
|
|
||||||
const { ownerId, prefix } = process.env;
|
const { ownerId, prefix } = process.env;
|
||||||
const prefixs = prefix.split(',');
|
const prefixs = prefix.split(',');
|
||||||
|
@ -312,32 +313,26 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ratelimit = global.ratelimit;
|
|
||||||
if (!ratelimit[userID]) {
|
|
||||||
ratelimit[userID] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
if (ratelimit[userID][commandName]) {
|
if (ratelimit[userID]) {
|
||||||
if (ratelimit[userID][commandName].cooldown) {
|
if (ratelimit[userID].cooldown) {
|
||||||
if (date > ratelimit[userID][commandName].cooldown) {
|
if (commandName === ratelimit[userID].command && date > ratelimit[userID].cooldown) {
|
||||||
ratelimit[userID][commandName].limit = 0;
|
ratelimit[userID].limit = 0;
|
||||||
ratelimit[userID][commandName].cooldown = undefined;
|
ratelimit[userID].cooldown = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.ratelimit === ratelimit[userID][commandName].limit) {
|
if (commandName === ratelimit[userID].command && command.ratelimit === ratelimit[userID].limit) {
|
||||||
return await message.reply({ content: `You are being rate limited. You can try again in ${Math.floor((ratelimit[userID][commandName].cooldown - date) / 1000)} seconds.`, ephemeral: true });
|
return await message.reply({ content: `You are being rate limited. You can try again in ${Math.floor((ratelimit[userID].cooldown - date) / 1000)} seconds.`, ephemeral: true });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (command.ratelimit) {
|
if (command.ratelimit) {
|
||||||
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName] ? ratelimit[userID][commandName].limit + 1 : 1 };
|
ratelimit[userID] = { command: commandName, limit: ratelimit[userID] ? ratelimit[userID].limit + 1 : 1 };
|
||||||
if (command.ratelimit === ratelimit[userID][commandName].limit) {
|
if (command.ratelimit === ratelimit[userID].limit) {
|
||||||
date.setSeconds(date.getSeconds() + command.cooldown);
|
date.setSeconds(date.getSeconds() + command.cooldown);
|
||||||
|
|
||||||
ratelimit[userID][commandName] = { limit: ratelimit[userID][commandName].limit, cooldown: date };
|
ratelimit[userID] = { command: commandName, limit: ratelimit[userID].limit, cooldown: date };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message.user = message.author;
|
message.user = message.author;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { EmbedBuilder } from 'discord.js';
|
import { EmbedBuilder } from 'discord.js';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import db from '../../models/index.js';
|
import db from '../../models/index.js';
|
||||||
|
global.boards = {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'messageReactionAdd',
|
name: 'messageReactionAdd',
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { EmbedBuilder } from 'discord.js';
|
import { EmbedBuilder } from 'discord.js';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import db from '../../models/index.js';
|
import db from '../../models/index.js';
|
||||||
|
global.boards = {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'messageReactionRemove',
|
name: 'messageReactionRemove',
|
||||||
|
|
|
@ -5,10 +5,6 @@ export default {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
once: true,
|
once: true,
|
||||||
async execute(client) {
|
async execute(client) {
|
||||||
// Init global variables.
|
|
||||||
global.ratelimit = {};
|
|
||||||
global.boards = {};
|
|
||||||
|
|
||||||
const ytdlpVersion = await new Promise((resolve, reject) => {
|
const ytdlpVersion = await new Promise((resolve, reject) => {
|
||||||
exec('./bin/yt-dlp --version', (err, stdout, stderr) => {
|
exec('./bin/yt-dlp --version', (err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue