Skip to content

Commit 6160133

Browse files
committed
bug fixes
updated some code usage to match the latest discord.js and fixed some broken bugs
1 parent 73fd49d commit 6160133

13 files changed

+675
-539
lines changed

commands/ban.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
2+
const { SlashCommandBuilder, PermissionFlagsBits, InteractionContextType } = require("discord.js");
33
const wait = require("node:timers/promises").setTimeout;
44

55
module.exports = {
66
data: new SlashCommandBuilder()
77
.setName("ban")
88
.setDescription("Fake bans people!")
99
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
10-
.setDMPermission(false)
10+
.setContexts(InteractionContextType.Guild)
1111
.addUserOption((option) => option.setName("user").setDescription("The user you want to ban").setRequired(true))
1212
.addStringOption((option) =>
1313
option.setName("reason").setDescription("Reason why you are banning the user").setRequired(true)
@@ -20,7 +20,7 @@ module.exports = {
2020
embeds: [
2121
{
2222
color: 0x43b582,
23-
description: `<:botSuccess:1279325617476735098> ***${user.tag} was banned*** | ${reason}`,
23+
description: `<:botSuccess:1279325617476735098> ***${user.tag} was banned.***`,
2424
},
2525
],
2626
});
@@ -30,7 +30,7 @@ module.exports = {
3030
embeds: [
3131
{
3232
color: 0xf04a47,
33-
description: `You were banned from ${guild.name} | ${reason}`,
33+
description: `You were banned from ${guild.name} for ${reason}`,
3434
},
3535
],
3636
});

commands/changelog.js

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module.exports = {
1010
color: 0x0ccab6,
1111
title: "**Bot Changelog**",
1212
description: "Date: August 7, 2024",
13-
timestamp: new Date().toISOString(),
1413
fields: [
1514
{
1615
name: "Added `/encrypt` and `/decrypt` command",

commands/feedback.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require("dotenv").config();
2-
const { ActionRowBuilder, Events, ModalBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");
3-
const { SlashCommandBuilder } = require("discord.js");
2+
const { SlashCommandBuilder, ActionRowBuilder, Events, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags } = require("discord.js");
43

54
module.exports = {
65
data: new SlashCommandBuilder().setName("feedback").setDescription("Send some feedback to the bot developer! (This doesn't work at the moment)"),
@@ -44,7 +43,7 @@ module.exports = {
4443
description: "Successfully sent feedback!",
4544
},
4645
],
47-
ephemeral: true,
46+
flags: MessageFlags.Ephemeral,
4847
});
4948
}
5049
});

commands/fuckoff.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
2+
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionFlagsBits, InteractionContextType, MessageFlags } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
66
.setName("fuckoff")
77
.setDescription("A fancy way to kick this bot! >:(")
88
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
9-
.setDMPermission(false),
9+
.setContexts(InteractionContextType.Guild),
1010
async execute(interaction) {
1111
const { guild } = interaction;
1212

@@ -24,7 +24,7 @@ module.exports = {
2424
description: "Only the moderators can perform this action!",
2525
},
2626
],
27-
ephemeral: true,
27+
flags: MessageFlags.Ephemeral,
2828
});
2929
}
3030

@@ -58,7 +58,7 @@ module.exports = {
5858
},
5959
],
6060
components: [actionRow],
61-
ephemeral: true,
61+
flags: MessageFlags.Ephemeral,
6262
});
6363
collector.stop();
6464
} else if (i.customId === "leaveNow") {
@@ -72,7 +72,7 @@ module.exports = {
7272
},
7373
],
7474
components: [actionRow],
75-
ephemeral: true,
75+
flags: MessageFlags.Ephemeral,
7676
});
7777
collector.stop();
7878
guild.leave();
@@ -91,7 +91,7 @@ module.exports = {
9191
},
9292
],
9393
components: [actionRow],
94-
ephemeral: true,
94+
flags: MessageFlags.Ephemeral,
9595
});
9696
guild.leave();
9797
}

commands/help.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder } = require("discord.js");
2+
const { SlashCommandBuilder, MessageFlags } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder().setName("help").setDescription("How to check my available commands!"),
@@ -19,7 +19,7 @@ module.exports = {
1919
],
2020
},
2121
],
22-
ephemeral: true,
22+
flags: MessageFlags.Ephemeral,
2323
});
2424
},
2525
};

commands/reload.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder, PermissionFlagsBits } = require("discord.js");
2+
const { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
@@ -17,7 +17,7 @@ module.exports = {
1717
description: "Only the bot owner can perform this action!",
1818
},
1919
],
20-
ephemeral: true,
20+
flags: MessageFlags.Ephemeral,
2121
});
2222
await interaction.reply({
2323
embeds: [
@@ -27,7 +27,7 @@ module.exports = {
2727
description: "Bot is now rebooting!",
2828
},
2929
],
30-
ephemeral: true,
30+
flags: MessageFlags.Ephemeral,
3131
});
3232
await client.destroy();
3333
return process.exit(0);

commands/server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder, ChannelType } = require("discord.js");
2+
const { SlashCommandBuilder, ChannelType, InteractionContextType } = require("discord.js");
33

44
module.exports = {
55
data: new SlashCommandBuilder()
66
.setName("server")
77
.setDescription("Look up the current Discord server information!")
8-
.setDMPermission(false),
8+
.setContexts(InteractionContextType.Guild),
99
async execute(interaction) {
1010
const { guild } = interaction;
1111
const { createdTimestamp, ownerId, description, members, memberCount, channels, emojis, stickers } = guild;

commands/sue.js

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
2+
const {
3+
SlashCommandBuilder,
4+
ActionRowBuilder,
5+
ButtonBuilder,
6+
ButtonStyle,
7+
InteractionContextType,
8+
MessageFlags,
9+
} = require("discord.js");
310

411
module.exports = {
512
data: new SlashCommandBuilder()
613
.setName("sue")
714
.setDescription("Fake lawsuits to sue anyone!")
8-
.setDMPermission(false)
15+
.setContexts(InteractionContextType.Guild)
916
.addUserOption((option) =>
1017
option.setName("user").setDescription("The user you want to start a lawsuit against").setRequired(true)
1118
)
@@ -31,17 +38,21 @@ module.exports = {
3138
description: "Why would you sue yourself?",
3239
},
3340
],
34-
ephemeral: true,
41+
flags: MessageFlags.Ephemeral,
3542
});
3643

37-
if (user.id === process.env.OWNERID) {
44+
if (user.bot === true && interaction.user.id === process.env.OWNERID) {
45+
sentence = "Defendant needs to pay the plaintiff $10M USD\nDefendant sentenced to death";
46+
additionalFooterNote = "";
47+
} else if (user.id === process.env.OWNERID) {
3848
sentence = "Plaintiff needs to pay the defendant $10M USD\nPlaintiff sentenced to death";
3949
additionalFooterNote = "imagine suing the owner lol, i own this court dude";
4050
} else if (user.bot === true) {
4151
sentence = "Defendant is not guilty\nPlaintiff needs to pay the defendant $1M USD";
4252
additionalFooterNote = "imagine suing a bot lol";
4353
} else {
4454
sentence = "Death Penalty";
55+
additionalFooterNote = "";
4556
}
4657

4758
await interaction.reply({
@@ -64,11 +75,8 @@ module.exports = {
6475
value: details,
6576
},
6677
],
67-
timestamp: new Date().toISOString(),
6878
footer: {
69-
text:
70-
`Disclaimer: It's not real.` ||
71-
`Disclaimer: It's not real. also ${additionalFooterNote}`,
79+
text: `Disclaimer: It's not real.` || `Disclaimer: It's not real. also ${additionalFooterNote}`,
7280
},
7381
},
7482
],
@@ -82,13 +90,14 @@ module.exports = {
8290

8391
collector.on("ignore", (i) =>
8492
i.reply({
85-
ephemeral: true,
8693
embeds: [
87-
new EmbedBuilder({
94+
{
95+
color: 0x0ccab6,
8896
title: "**Lawsuit Generator**",
8997
description: "You're not the author of the lawsuit!",
90-
}),
98+
},
9199
],
100+
flags: MessageFlags.Ephemeral,
92101
})
93102
);
94103
collector.on("collect", async (i) => {
@@ -126,7 +135,6 @@ module.exports = {
126135
value: sentence,
127136
},
128137
],
129-
timestamp: new Date().toISOString(),
130138
footer: {
131139
text:
132140
additionalFooterNote === ""

commands/urban.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require("dotenv").config();
2-
const { SlashCommandBuilder } = require("discord.js");
2+
const { SlashCommandBuilder, MessageFlags } = require("discord.js");
33
const axios = require("axios");
44

55
module.exports = {
@@ -28,7 +28,7 @@ module.exports = {
2828

2929
},
3030
],
31-
ephemeral: true,
31+
flags: MessageFlags.Ephemeral,
3232
});
3333
let data = fetch[0];
3434
let definition = data.definition || "No definition found";

events/interactionCreate.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require("dotenv").config();
2+
const { MessageFlags } = require("discord.js");
23
module.exports = {
34
name: "interactionCreate",
45
async execute(interaction) {
@@ -21,7 +22,7 @@ module.exports = {
2122
},
2223
],
2324
content: "",
24-
ephemeral: true,
25+
flags: MessageFlags.Ephemeral,
2526
});
2627
}
2728
},

index.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Core codes
2-
32
const fs = require("node:fs");
43
const path = require("node:path");
54
const {
@@ -23,7 +22,6 @@ const client = new Client({
2322
require("dotenv").config({ path: path.resolve(__dirname, ".env") });
2423

2524
// Commands Handler
26-
2725
client.commands = new Collection();
2826

2927
const commandsPath = path.join(__dirname, "commands");
@@ -45,7 +43,6 @@ for (const file of commandFiles) {
4543
}
4644

4745
// Events Handler
48-
4946
const eventsPath = path.join(__dirname, "events");
5047
const eventFiles = fs
5148
.readdirSync(eventsPath)

0 commit comments

Comments
 (0)