This commit is contained in:
yhqe committed 2026-03-12 22:12:53 -05:00
1 parent 9f9c852a36
commit 09ddaba972
18 files changed
+1205 -64

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
'use strict';
const fs = require('fs');
const path = require('path');
const { time } = require("discord.js");
module.exports = {
name: 'autorole',
description: `assign a role to new members when they join the server`,
aliases: ['ar'],
usage: 'autorole <role>',
async execute(client, message, args) {
if (!message.member.permissions.has('Administrator')) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> you do not have permission to use this command!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
const role = message.mentions.roles.first() || message.guild.roles.cache.get(args[0]);
if (!role) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> please provide a valid role!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
// add the role to a json file for the guild and save it to be used when new members join (if the role is already in the database, update it to the new role)
const dbPath = path.join(__dirname, '..', '..', 'db.json');
let db = {};
if (fs.existsSync(dbPath)) {
db = JSON.parse(fs.readFileSync(dbPath, 'utf8'));
}
if (!db.autoroles) {
db.autoroles = {};
}
db.autoroles[message.guild.id] = role.id;
fs.writeFileSync(dbPath, JSON.stringify(db, null, 2));
message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: `<:check:1481811973447356496> "${role.name}" has been set as the autorole!`,
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
};
+88
View File
@@ -0,0 +1,88 @@
'use strict';
const { time } = require("discord.js");
module.exports = {
name: 'ban',
description: `ban a user from the current server`,
aliases: ['banish'],
usage: 'ban <user> [reason] [duration]',
async execute(client, message, args) {
if (!message.member.permissions.has('BanMembers')) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> you do not have permission to use this command!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
const user = message.mentions.users.first() || client.users.cache.get(args[0]);
if (!user) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> please specify a user to ban!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
const reason = args.slice(1).join(' ') || 'no reason provided (twitter)';
const duration = args[2] ? parseInt(args[2]) : null;
try {
await message.guild.members.ban(user, { reason });
message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: `<:check:1481811973447356496> ${user.username} has been banned!`,
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
} catch (error) {
console.error(error);
message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> an error occurred while trying to ban the user!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
},
};
+43 -13
View File
@@ -1,8 +1,10 @@
const { EmbedBuilder } = require('discord.js');
'use strict';
module.exports = {
name: 'help',
description: 'Lists all available commands or shows info about a specific one.',
description: 'lists all available commands or shows info about a specific one',
aliases: ['h', 'commands'],
usage: 'help [command]',
@@ -15,17 +17,29 @@ module.exports = {
const command = client.commands.get(name);
if (!command) {
return message.reply(`No command found for \`${name}\`.`);
return message.reply(`no command found for \`${name}\`.`);
}
const lines = [`**${prefix}${command.name}**`];
if (command.description) lines.push(`> ${command.description}`);
if (command.aliases?.length)
lines.push(`> **Aliases:** ${command.aliases.map((a) => `\`${prefix}${a}\``).join(', ')}`);
if (command.usage)
lines.push(`> **Usage:** \`${prefix}${command.usage}\``);
const embed = new EmbedBuilder()
.setColor(0x1da1f2)
.setTitle(`${prefix}${command.name}`)
.setDescription(command.description || 'no description');
return message.reply(lines.join('\n'));
if (command.aliases?.length) {
embed.addFields({
name: 'aliases',
value: command.aliases.map((a) => `\`${prefix}${a}\``).join(', '),
});
}
if (command.usage) {
embed.addFields({
name: 'usage',
value: `\`${prefix}${command.usage}\``,
});
}
return message.reply({ embeds: [embed] });
}
// Build a deduplicated command list (ignore aliases pointing to the same command)
@@ -35,11 +49,27 @@ module.exports = {
for (const command of client.commands.values()) {
if (seen.has(command.name)) continue;
seen.add(command.name);
commandList.push(`\`${prefix}${command.name}\` — ${command.description || 'No description.'}`);
commandList.push(`\`${prefix}${command.name}\` — ${command.description || 'no description'}`);
}
return message.reply(
`**Available commands:**\n${commandList.join('\n')}\n\nUse \`${prefix}help <command>\` for more details.`,
);
const embed = {
color: 0x8aa2b3,
title: '',
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: `-# use ${prefix}help <command> for more details`,
fields: [
{ name: 'commands', value: commandList.join('\n') },
],
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
};
return message.reply({ embeds: [embed] });
},
};
+88
View File
@@ -0,0 +1,88 @@
'use strict';
const { time } = require("discord.js");
module.exports = {
name: 'kick',
description: `kick a user from the current server`,
aliases: ['kick'],
usage: 'kick <user> [reason]',
async execute(client, message, args) {
if (!message.member.permissions.has('KickMembers')) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> you do not have permission to use this command!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
const user = message.mentions.users.first() || client.users.cache.get(args[0]);
if (!user) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> please specify a user to ban!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
const reason = args.slice(1).join(' ') || 'no reason provided (twitter)';
const duration = args[2] ? parseInt(args[2]) : null;
try {
await message.guild.members.kick(user, { reason });
message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: `<:check:1481811973447356496> ${user.username} has been kicked!`,
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
} catch (error) {
console.error(error);
message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: '<:no:1481811955592466492> an error occurred while trying to ban the user!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}]
});
}
},
};
+30 -5
View File
@@ -1,18 +1,43 @@
'use strict';
const { time } = require("discord.js");
module.exports = {
name: 'ping',
description: 'Replies with Pong! and shows the bot latency.',
description: `test the bot's latency to discord's servers and api`,
aliases: ['pong'],
usage: 'ping',
async execute(client, message) {
const sent = await message.reply('Pinging…');
const sent = await message.reply('pinging');
const latency = sent.createdTimestamp - message.createdTimestamp;
const apiLatency = Math.round(client.ws.ping);
await sent.edit(
`🏓 Pong!\n> Bot latency: **${latency}ms** | API latency: **${apiLatency}ms**`,
);
const embed = {
color: 0x8aa2b3,
title: '',
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: 'fuck you!!!! 🖕',
fields: [
{ name: '# of cmds loaded', value: `**${client.commands.size}**`, inline: true },
{ name: 'bot latency', value: `**${latency}ms**`, inline: true },
{ name: 'api latency', value: `**${apiLatency}ms**`, inline: true },
],
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
thumbnail: {
url: client.user.displayAvatarURL(),
height: 1024,
width: 1024,
},
};
await sent.edit({ content: null, embeds: [embed] });
},
};
+61
View File
@@ -0,0 +1,61 @@
'use strict';
const { time } = require("discord.js");
module.exports = {
name: 'purge',
description: `delete a specified number of messages from the current channel`,
aliases: ['clear', 'p'],
usage: 'purge <number>',
async execute(client, message) {
if (!message.member.permissions.has('ManageMessages')) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
description: '<:no:1481811955592466492> you do not have permission to use this command!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}],
});
}
const args = message.content.split(' ').slice(1);
const amount = parseInt(args[0]) + 1;
if (isNaN(amount) || amount < 1 || amount > 100) {
return message.reply({
content: null, embeds: [{
color: 0x8aa2b3,
description: '<:no:1481811955592466492> please provide a number between 1 and 100!',
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}],
});
}
const deletedMessages = await message.channel.bulkDelete(amount, true);
const reply = await message.channel.send({
content: null, embeds: [{
color: 0x8aa2b3,
author: {
name: message.author.username,
icon_url: message.author.displayAvatarURL(),
},
description: `<:no:1481811955592466492> successfully deleted ${deletedMessages.size - 1} messages!`,
footer: {
text: `twitter @ ${message.guild.name}`,
icon_url: client.user.displayAvatarURL(),
},
timestamp: new Date(),
}],
});
setTimeout(() => reply.delete().catch(() => { }), 5000);
},
};