Compare commits
4 commits
511111cf59
...
cffa0ea718
Author | SHA1 | Date | |
---|---|---|---|
cffa0ea718 | |||
3b38401afc | |||
ce945612da | |||
4530b265e7 |
11 changed files with 201 additions and 31 deletions
37
commands/owner/deletetweet.js
Normal file
37
commands/owner/deletetweet.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
import Twit from 'twit';
|
||||||
|
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
dotenv.config();
|
||||||
|
const { twiConsumer, twiConsumerSecret, twiToken, twiTokenSecret } = process.env;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('deletewteet')
|
||||||
|
.setDescription('Delete a tweet')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('tweetid')
|
||||||
|
.setDescription('The id of the tweet you wish to delete.')
|
||||||
|
.setRequired(true)),
|
||||||
|
ownerOnly: true,
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply();
|
||||||
|
try {
|
||||||
|
const T = new Twit({
|
||||||
|
consumer_key: twiConsumer,
|
||||||
|
consumer_secret: twiConsumerSecret,
|
||||||
|
access_token: twiToken,
|
||||||
|
access_token_secret: twiTokenSecret,
|
||||||
|
});
|
||||||
|
|
||||||
|
T.post('statuses/destroy', {
|
||||||
|
id: interaction.options.getString('tweetid'),
|
||||||
|
});
|
||||||
|
return interaction.editReply('Tweet have been deleted!');
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return interaction.editReply('Oh no, an error has occurred :(');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,17 +1,12 @@
|
||||||
import { SlashCommandBuilder } from '@discordjs/builders';
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
import dotenv from 'dotenv';
|
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
dotenv.config();
|
|
||||||
const { ownerId } = process.env;
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName('die')
|
.setName('die')
|
||||||
.setDescription('Kill the bot'),
|
.setDescription('Kill the bot'),
|
||||||
|
ownerOnly: true,
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
if (interaction.user.id !== ownerId) {
|
|
||||||
return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
|
|
||||||
}
|
|
||||||
console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m');
|
console.log('\x1b[31m\x1b[47m\x1b[5mSHUTING DOWN!!!!!\x1b[0m');
|
||||||
await interaction.reply({ content: 'Good bye', ephemeral: true })
|
await interaction.reply({ content: 'Good bye', ephemeral: true })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
70
commands/owner/ublacklist.js
Normal file
70
commands/owner/ublacklist.js
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
import { MessageButton, MessageActionRow } from 'discord.js';
|
||||||
|
import db from '../../models/index.js';
|
||||||
|
const Blacklists = db.Blacklists;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('ublacklist')
|
||||||
|
.setDescription('Blacklist a user from the bot')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('command')
|
||||||
|
.setDescription('Which command do you want to get a user blacklisted from?')
|
||||||
|
.setRequired(true))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('userid')
|
||||||
|
.setDescription('Who do you want to blacklist?')
|
||||||
|
.setRequired(true))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('reason')
|
||||||
|
.setDescription('The reason of the blacklist.')
|
||||||
|
.setRequired(false)),
|
||||||
|
ownerOnly: true,
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
const client = interaction.client;
|
||||||
|
const command = interaction.options.getString('command');
|
||||||
|
const userid = interaction.options.getString('userid');
|
||||||
|
const reason = interaction.options.getString('reason');
|
||||||
|
|
||||||
|
const blacklist = await Blacklists.findOne({ where: { type:command, uid:userid } });
|
||||||
|
|
||||||
|
if (!blacklist) {
|
||||||
|
const body = { type:command, uid: userid, reason: reason };
|
||||||
|
Blacklists.create(body);
|
||||||
|
let user = userid;
|
||||||
|
if (command !== 'guild') {user = client.users.resolve(userid).tag;}
|
||||||
|
|
||||||
|
return interaction.editReply(`${user} has been blacklisted from ${command} with the following reason ${reason}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const row = new MessageActionRow()
|
||||||
|
.addComponents(
|
||||||
|
new MessageButton()
|
||||||
|
.setCustomId('yes')
|
||||||
|
.setLabel('Yes')
|
||||||
|
.setStyle('PRIMARY'),
|
||||||
|
)
|
||||||
|
.addComponents(
|
||||||
|
new MessageButton()
|
||||||
|
.setCustomId('no')
|
||||||
|
.setLabel('No')
|
||||||
|
.setStyle('DANGER'),
|
||||||
|
);
|
||||||
|
|
||||||
|
await interaction.editReply({ content: 'This user is already blacklisted, do you want to unblacklist him?', ephemeral: true, components: [row] });
|
||||||
|
|
||||||
|
interaction.client.once('interactionCreate', async (interactionMenu) => {
|
||||||
|
if (!interactionMenu.isButton) return;
|
||||||
|
interactionMenu.update({ components: [] });
|
||||||
|
if (interactionMenu.customId === 'yes') {
|
||||||
|
Blacklists.destroy({ where: { type:command, uid:userid } });
|
||||||
|
return interaction.editReply(`The following ID have been unblacklisted from ${command}: ${userid}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return interaction.editReply('No one has been unblacklisted.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
30
commands/utility/donator.js
Normal file
30
commands/utility/donator.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
import db from '../../models/index.js';
|
||||||
|
const donator = db.donator;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('donator')
|
||||||
|
.setDescription('All the people who donated for this bot <3'),
|
||||||
|
async execute(interaction) {
|
||||||
|
await interaction.deferReply();
|
||||||
|
const client = interaction.client;
|
||||||
|
const Donator = await donator.findAll({ order: ['id'] });
|
||||||
|
|
||||||
|
let donatorMessage = 'Thanks to:\n';
|
||||||
|
|
||||||
|
if (Donator[0]) {
|
||||||
|
for (let i = 0; i < Donator.length; i++) {
|
||||||
|
const user = await client.users.fetch(Donator[i].get('userID').toString());
|
||||||
|
if (user !== null) {donatorMessage += `**${user.tag} (${user.id}) | ${Donator[i].get('comment')}**\n`;}
|
||||||
|
else {donatorMessage += `**A user of discord (${user.id}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
donatorMessage += 'No one :(';
|
||||||
|
}
|
||||||
|
|
||||||
|
return interaction.editReply(donatorMessage);
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,18 +0,0 @@
|
||||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
||||||
const { REST } = require('@discordjs/rest');
|
|
||||||
const { Routes } = require('discord-api-types/v9');
|
|
||||||
require('dotenv').config();
|
|
||||||
const { clientId, guildId, token } = process.env;
|
|
||||||
|
|
||||||
const commands = [
|
|
||||||
new SlashCommandBuilder()
|
|
||||||
.setName('die')
|
|
||||||
.setDescription('Kill the bot'),
|
|
||||||
]
|
|
||||||
.map(command => command.toJSON());
|
|
||||||
|
|
||||||
const rest = new REST({ version: '9' }).setToken(token);
|
|
||||||
|
|
||||||
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
|
|
||||||
.then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`))
|
|
||||||
.catch(console.error);
|
|
|
@ -4,7 +4,7 @@ import { MessageEmbed } from 'discord.js';
|
||||||
|
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
const { statusChannel } = process.env;
|
const { statusChannel, NODE_ENV } = process.env;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'guildCreate',
|
name: 'guildCreate',
|
||||||
|
@ -21,7 +21,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If stats channel settings exist, send bot stats to it
|
// If stats channel settings exist, send bot stats to it
|
||||||
if (statusChannel) {
|
if (statusChannel && NODE_ENV !== 'development') {
|
||||||
const channel = client.channels.resolve(statusChannel);
|
const channel = client.channels.resolve(statusChannel);
|
||||||
const botCount = guild.members.cache.filter(member => member.user.bot).size;
|
const botCount = guild.members.cache.filter(member => member.user.bot).size;
|
||||||
console.log(guild.memberCount);
|
console.log(guild.memberCount);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { MessageEmbed } from 'discord.js';
|
||||||
|
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
const { statusChannel } = process.env;
|
const { statusChannel, NODE_ENV } = process.env;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'guildDelete',
|
name: 'guildDelete',
|
||||||
|
@ -17,7 +17,7 @@ export default {
|
||||||
const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } });
|
const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } });
|
||||||
|
|
||||||
// If stats channel settings exist, send bot stats to it
|
// If stats channel settings exist, send bot stats to it
|
||||||
if (statusChannel) {
|
if (statusChannel && NODE_ENV !== 'development') {
|
||||||
const channel = client.channels.resolve(statusChannel);
|
const channel = client.channels.resolve(statusChannel);
|
||||||
const botCount = guild.members.cache.filter(member => member.user.bot).size;
|
const botCount = guild.members.cache.filter(member => member.user.bot).size;
|
||||||
console.log(guild.memberCount);
|
console.log(guild.memberCount);
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import db from '../../models/index.js';
|
import db from '../../models/index.js';
|
||||||
const ratelimit = {};
|
const ratelimit = {};
|
||||||
|
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
dotenv.config();
|
||||||
|
const { ownerId } = process.env;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
|
@ -20,10 +25,15 @@ export default {
|
||||||
const commandName = interaction.commandName;
|
const commandName = interaction.commandName;
|
||||||
|
|
||||||
const command = client.commands.get(commandName);
|
const command = client.commands.get(commandName);
|
||||||
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m`);
|
|
||||||
|
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
|
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m`);
|
||||||
|
|
||||||
|
if (command.ownerOnly && interaction.user.id !== ownerId) {
|
||||||
|
return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
if (ratelimit[userID]) {
|
if (ratelimit[userID]) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { exec } from 'node:child_process';
|
import { exec } from 'node:child_process';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
const { statusChannel } = process.env;
|
const { statusChannel, NODE_ENV } = process.env;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
||||||
console.log('===========[ READY ]===========');
|
console.log('===========[ READY ]===========');
|
||||||
|
|
||||||
// If stats channel settings exist, send bot stats to it
|
// If stats channel settings exist, send bot stats to it
|
||||||
if (statusChannel) {
|
if (statusChannel && NODE_ENV !== 'development') {
|
||||||
const channel = client.channels.resolve(statusChannel);
|
const channel = client.channels.resolve(statusChannel);
|
||||||
channel.send(`Ready to serve in ${channelSize} channels on ${guildSize} servers.\nThere is ${commandSize} command loaded.\nRunning yt-dlp ${ytdlpVersion.replace('\n', '')}\n${client.readyAt}`);
|
channel.send(`Ready to serve in ${channelSize} channels on ${guildSize} servers.\nThere is ${commandSize} command loaded.\nRunning yt-dlp ${ytdlpVersion.replace('\n', '')}\n${client.readyAt}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,10 @@ const commands = [
|
||||||
option.setName('board')
|
option.setName('board')
|
||||||
.setDescription('The board you wish to see')
|
.setDescription('The board you wish to see')
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
|
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName('donator')
|
||||||
|
.setDescription('All the people who donated for this bot <3'),
|
||||||
]
|
]
|
||||||
.map(command => command.toJSON());
|
.map(command => command.toJSON());
|
||||||
|
|
42
scripts/deploy-owner-commands.cjs
Normal file
42
scripts/deploy-owner-commands.cjs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||||
|
const { REST } = require('@discordjs/rest');
|
||||||
|
const { Routes } = require('discord-api-types/v9');
|
||||||
|
require('dotenv').config();
|
||||||
|
const { clientId, guildId, token } = process.env;
|
||||||
|
|
||||||
|
const commands = [
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName('die')
|
||||||
|
.setDescription('Kill the bot'),
|
||||||
|
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName('ublacklist')
|
||||||
|
.setDescription('Blacklist a user from the bot')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('command')
|
||||||
|
.setDescription('Which command do you want to get a user blacklisted from?')
|
||||||
|
.setRequired(true))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('userid')
|
||||||
|
.setDescription('Who do you want to blacklist?')
|
||||||
|
.setRequired(true))
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('reason')
|
||||||
|
.setDescription('The reason of the blacklist.')
|
||||||
|
.setRequired(false)),
|
||||||
|
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName('deletewteet')
|
||||||
|
.setDescription('Delete a tweet')
|
||||||
|
.addStringOption(option =>
|
||||||
|
option.setName('tweetid')
|
||||||
|
.setDescription('The id of the tweet you wish to delete.')
|
||||||
|
.setRequired(true)),
|
||||||
|
]
|
||||||
|
.map(command => command.toJSON());
|
||||||
|
|
||||||
|
const rest = new REST({ version: '9' }).setToken(token);
|
||||||
|
|
||||||
|
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
|
||||||
|
.then(() => console.log(`Successfully registered application commands for the guild ${guildId}.`))
|
||||||
|
.catch(console.error);
|
Loading…
Reference in a new issue