Skip to content

Commit 6763157

Browse files
committed
Update Discord.js version
1 parent 730ce6f commit 6763157

File tree

9 files changed

+65
-25
lines changed

9 files changed

+65
-25
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ node_modules/
33
package-lock.json
44

55
# Typescript Output
6-
dist/
6+
dist/
7+
8+
# IDEs
9+
.idea
10+
.vscode

src/modules/admin/listeners/WelcomeMessage.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import {Listeners} from "../../../interfaces/Listeners";
22
import {AllyClient} from "../../../interfaces/AllyClient";
3-
import {Events, GuildMember, TextBasedChannel} from "discord.js";
3+
import {Events, GuildMember, SendableChannels, TextBasedChannel} from "discord.js";
44

55
export const Listener: Listeners<Events.GuildMemberAdd> = {
66
event: Events.GuildMemberAdd,
77
purpose: "Welcome message",
88
run(client: AllyClient, listener: GuildMember): void {
9+
//TODO: Add ability to change what channel to send message to.
910
const welcomeChannelId = listener.guild.systemChannelId; //Add ability to change channel to send to
1011
listener.guild.channels.fetch(welcomeChannelId).then((channel) => {
11-
if (channel.isTextBased) {
12-
let welcomeChannel = channel as TextBasedChannel;
12+
if (channel.isSendable()) {
13+
let welcomeChannel = channel as SendableChannels;
1314
let messageContent = `Hello ${listener.displayName}!`;
1415

1516
welcomeChannel.send(messageContent);

src/modules/misc/commands/help.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export const SlashCommand: Command = {
88
moduleName: "Misc",
99
type: ApplicationCommandType.ChatInput,
1010
run: async (client: AllyClient, interaction: CommandInteraction) => {
11-
var types = new Array<string>();
12-
var row = new ActionRowBuilder<MessageActionRowComponentBuilder>();
11+
let types = new Array<string>();
12+
let row = new ActionRowBuilder<MessageActionRowComponentBuilder>();
1313

1414
client.commands.each((command) => {
1515
if (!types.includes(command.moduleName)) types.push(command.moduleName);
1616
});
1717

18-
var embed = new EmbedBuilder()
18+
let embed = new EmbedBuilder()
1919
.setTitle("Command List")
2020
.setDescription("Here is a list of all the commands you can use!")
2121
.setColor(0xAD93EE);
@@ -39,7 +39,7 @@ export const SlashCommand: Command = {
3939
followup(client, interaction) {
4040
const type = interaction.customId.split(".")[1];
4141

42-
var embed = new EmbedBuilder()
42+
let embed = new EmbedBuilder()
4343
.setTitle(`${type} Commands`)
4444
.setDescription(`Here is a list of all the commands for the ${type} module!`)
4545
.setColor(0xAD93EE);

src/modules/moderation/commands/ban.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
import {
2-
CommandInteraction,
2+
CommandInteraction, Embed,
33
EmbedBuilder,
44
PermissionFlagsBits,
55
SlashCommandBuilder,
66
} from "discord.js";
77
import { AllyClient } from "../../../interfaces/AllyClient";
88
import { Command } from "../../../interfaces/Commands";
9+
import {Embeds} from "../../../utility/Embeds";
910

1011
export const SlashCommand: Command = {
1112
name: "ban",
1213
description: "Command for banning server members",
1314
moduleName: "Moderation",
1415
run: (client: AllyClient, interaction: CommandInteraction) => {
15-
var user = interaction.options.getUser("user");
16-
var banReason = interaction.options.get("reason").value as string;
17-
var guild = interaction.guild;
16+
let user = interaction.options.get("user", true).user;
17+
let banReason = interaction.options.get("reason").value as string;
18+
let guild = interaction.guild;
1819

1920
guild.members
2021
.ban(user, {
2122
reason: banReason,
2223
})
2324
.then(() => {
24-
var embed = new EmbedBuilder()
25+
let embed = new Embeds()
2526
.setTitle("Member banned")
26-
.setDescription(`${user} was banned from ${guild.name}`)
27-
.setFooter({
28-
text: "This Discord bot was made with Discord Bot Builder",
29-
}).setColor("Red");
27+
.setDescription(`${user} was banned from ${guild.name}`);
3028

3129
interaction.reply({ embeds: [embed] });
3230
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {
2+
CommandInteraction,
3+
PermissionFlagsBits,
4+
SlashCommandBuilder,
5+
} from "discord.js";
6+
import {AllyClient} from "../../../interfaces/AllyClient";
7+
import {Command} from "../../../interfaces/Commands";
8+
9+
export const SlashCommand: Command = {
10+
name: "lock",
11+
description: "Locks a channel to all users",
12+
moduleName: "Moderation",
13+
run: (client: AllyClient, interaction: CommandInteraction) => {
14+
15+
},
16+
command: new SlashCommandBuilder()
17+
.setName("lock")
18+
.setDescription("Locks a channel to all users")
19+
.addChannelOption((option) => {
20+
return option
21+
.setName("Channel")
22+
.setDescription("Channel inputted here will be locked")
23+
.setRequired(false)
24+
})
25+
.setDefaultMemberPermissions(PermissionFlagsBits.ManageChannels) as SlashCommandBuilder,
26+
};

src/modules/moderation/commands/mute.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "discord.js";
77
import { AllyClient } from "../../../interfaces/AllyClient";
88
import { Command } from "../../../interfaces/Commands";
9+
import {Embeds} from "../../../utility/Embeds";
910
const MIN_IN_MS = 60000;
1011
const MAX_TIME = 35791;
1112

@@ -14,9 +15,9 @@ export const SlashCommand: Command = {
1415
description: "Mute member",
1516
moduleName: "Moderation",
1617
run: (client: AllyClient, interaction: CommandInteraction) => {
17-
const embed = new EmbedBuilder();
18+
const embed = new Embeds();
1819

19-
const mentionedUser = interaction.options.getUser("user");
20+
const mentionedUser = interaction.options.get("user").user;
2021
const time = interaction.options.get("time", true).value as number;
2122
const guild = interaction.guild;
2223

src/modules/moderation/commands/unban.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export const SlashCommand: Command = {
1313
description: "Command for unbanning server members",
1414
moduleName: "Moderation",
1515
run: (client: AllyClient, interaction: CommandInteraction) => {
16-
var user = interaction.options.getUser("user");
17-
var guild = interaction.guild;
18-
var embed = new EmbedBuilder();
16+
let user = interaction.options.get("user").user;
17+
let guild = interaction.guild;
18+
let embed = new EmbedBuilder();
1919

2020
guild.bans.fetch().then((banCollection) => {
2121
if (!banCollection.has(user.id)) {

src/modules/moderation/commands/unmute.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export const SlashCommand: Command = {
1212
description: "Unmute server members",
1313
moduleName: "Moderation",
1414
run: (client: AllyClient, interaction: CommandInteraction) => {
15-
var embed = new EmbedBuilder();
15+
let embed = new EmbedBuilder();
1616

17-
var user = interaction.options.getUser("user");
18-
var guild = interaction.guild;
17+
let user = interaction.options.get("user").user;
18+
let guild = interaction.guild;
1919

2020
guild.members.fetch(user).then((fetchedUser) => {
2121
fetchedUser.timeout(null);

src/utility/Embeds.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {EmbedBuilder} from "discord.js";
2+
3+
export class Embeds extends EmbedBuilder {
4+
public constructor() {
5+
super();
6+
7+
this
8+
.setFooter({text: "This Discord bot was made with Discord Bot Builder"}).setColor("Green");
9+
}
10+
}

0 commit comments

Comments
 (0)