Skip to content

Commit 03686df

Browse files
committed
prettier
1 parent 7a89f26 commit 03686df

File tree

25 files changed

+800
-631
lines changed

25 files changed

+800
-631
lines changed

src/classes/Command.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { ApplicationCommandOptionData, PermissionResolvable, Permissions } from "discord.js";
2-
3-
export default class Command {
4-
public name: string;
5-
public description: string;
6-
public options: ApplicationCommandOptionData[];
7-
public default_member_permissions: Permissions | null;
8-
public botPermissions: PermissionResolvable[];
9-
public cooldown: number;
10-
public enabled: boolean;
11-
public deferReply: boolean;
12-
public ephemeral: boolean;
13-
public execute: Function;
14-
public autocomplete?: Function;
15-
}
1+
import { ApplicationCommandOptionData, PermissionResolvable, Permissions } from "discord.js";
2+
3+
export default class Command {
4+
public name: string;
5+
public description: string;
6+
public options: ApplicationCommandOptionData[];
7+
public default_member_permissions: Permissions | null;
8+
public botPermissions: PermissionResolvable[];
9+
public cooldown: number;
10+
public enabled: boolean;
11+
public deferReply: boolean;
12+
public ephemeral: boolean;
13+
public execute: Function;
14+
public autocomplete?: Function;
15+
}

src/classes/Event.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export default class Event {
2-
public name: string;
3-
public once: boolean;
4-
public execute: Function;
5-
}
1+
export default class Event {
2+
public name: string;
3+
public once: boolean;
4+
public execute: Function;
5+
}

src/classes/ExtendedClient.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { Client, Collection, Snowflake } from "discord.js";
2-
import config from "../../config.json";
3-
4-
export default class ExtendedClient extends Client {
5-
public commandIds: Collection<string, Snowflake>;
6-
public commands: Collection<string, any>;
7-
public config: typeof config;
8-
public events: Collection<string, any>;
9-
public logCommandError: Function;
10-
public logError: Function;
11-
public reminders: Map<string, NodeJS.Timeout>;
12-
public validPermissions: string[];
13-
}
1+
import { Client, Collection, Snowflake } from "discord.js";
2+
import config from "../../config.json";
3+
4+
export default class ExtendedClient extends Client {
5+
public commandIds: Collection<string, Snowflake>;
6+
public commands: Collection<string, any>;
7+
public config: typeof config;
8+
public events: Collection<string, any>;
9+
public logCommandError: Function;
10+
public logError: Function;
11+
public reminders: Map<string, NodeJS.Timeout>;
12+
public validPermissions: string[];
13+
}

src/commands/info/bot.ts

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,54 +14,69 @@ const command: Command = {
1414
enabled: true,
1515
deferReply: true,
1616
ephemeral: true,
17-
async execute(interaction: ChatInputCommandInteraction, client: ExtendedClient, Discord: typeof import("discord.js")) {
17+
async execute(
18+
interaction: ChatInputCommandInteraction,
19+
client: ExtendedClient,
20+
Discord: typeof import("discord.js")
21+
) {
1822
try {
19-
const guildCount = (await client.shard.fetchClientValues("guilds.cache.size")).reduce((acc: number, gc: number) => acc + gc, 0);
23+
const guildCount = (await client.shard.fetchClientValues("guilds.cache.size")).reduce(
24+
(acc: number, gc: number) => acc + gc,
25+
0
26+
);
2027

2128
const info = new Discord.EmbedBuilder()
2229
.setColor(client.config.embeds.default as ColorResolvable)
23-
.setAuthor({ name: client.user?.tag, iconURL: client.user?.displayAvatarURL({ extension: "png", forceStatic: false }), url: `https://discord.com/users/${client.user?.id}` })
24-
.setDescription(`
30+
.setAuthor({
31+
name: client.user?.tag,
32+
iconURL: client.user?.displayAvatarURL({
33+
extension: "png",
34+
forceStatic: false
35+
}),
36+
url: `https://discord.com/users/${client.user?.id}`
37+
}).setDescription(`
2538
${bot.description}
2639
2740
📈 **Version**: ${bot.version}
2841
🟢 **Online Since**: <t:${(Date.now() - client?.uptime).toString().slice(0, -3)}:f>
2942
🤖 **Shard ID**: #${client.shard.ids[0]}
3043
📊 **Guild Count**: ${guildCount} (this shard: ${client.guilds.cache.size})
31-
`)
44+
`);
3245

33-
const buttons: any = new Discord.ActionRowBuilder()
34-
.addComponents (
35-
new Discord.ButtonBuilder()
36-
.setStyle(Discord.ButtonStyle.Link)
37-
.setEmoji("🔗")
38-
.setLabel("Invite")
39-
.setURL("https://wdh.gg/reminders"),
46+
const buttons: any = new Discord.ActionRowBuilder().addComponents(
47+
new Discord.ButtonBuilder()
48+
.setStyle(Discord.ButtonStyle.Link)
49+
.setEmoji("🔗")
50+
.setLabel("Invite")
51+
.setURL("https://wdh.gg/reminders"),
4052

41-
new Discord.ButtonBuilder()
42-
.setStyle(Discord.ButtonStyle.Link)
43-
.setEmoji("🆘")
44-
.setLabel("Support")
45-
.setURL("https://wdh.gg/reminders/support"),
53+
new Discord.ButtonBuilder()
54+
.setStyle(Discord.ButtonStyle.Link)
55+
.setEmoji("🆘")
56+
.setLabel("Support")
57+
.setURL("https://wdh.gg/reminders/support"),
4658

47-
new Discord.ButtonBuilder()
48-
.setStyle(Discord.ButtonStyle.Link)
49-
.setEmoji("🗳️")
50-
.setLabel("Vote")
51-
.setURL("https://wdh.gg/reminders/vote"),
59+
new Discord.ButtonBuilder()
60+
.setStyle(Discord.ButtonStyle.Link)
61+
.setEmoji("🗳️")
62+
.setLabel("Vote")
63+
.setURL("https://wdh.gg/reminders/vote"),
5264

53-
new Discord.ButtonBuilder()
54-
.setStyle(Discord.ButtonStyle.Link)
55-
.setEmoji("🐙")
56-
.setLabel("GitHub")
57-
.setURL("https://wdh.gg/reminders/github")
58-
)
65+
new Discord.ButtonBuilder()
66+
.setStyle(Discord.ButtonStyle.Link)
67+
.setEmoji("🐙")
68+
.setLabel("GitHub")
69+
.setURL("https://wdh.gg/reminders/github")
70+
);
5971

60-
await interaction.editReply({ embeds: [info], components: [buttons] });
61-
} catch(err) {
72+
await interaction.editReply({
73+
embeds: [info],
74+
components: [buttons]
75+
});
76+
} catch (err) {
6277
client.logCommandError(err, interaction, Discord);
6378
}
6479
}
65-
}
80+
};
6681

6782
export = command;

src/commands/info/help.ts

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,27 @@ const command: Command = {
2323
enabled: true,
2424
deferReply: true,
2525
ephemeral: true,
26-
async execute(interaction: ChatInputCommandInteraction & any, client: ExtendedClient, Discord: typeof import("discord.js")) {
26+
async execute(
27+
interaction: ChatInputCommandInteraction & any,
28+
client: ExtendedClient,
29+
Discord: typeof import("discord.js")
30+
) {
2731
try {
2832
const cmd: any = interaction.options.get("command")?.value;
2933

3034
const commands: string[] = [];
3135

3236
async function pushRoot() {
33-
const files = fs.readdirSync(`./dist/commands`).filter(file => file.endsWith(".js"));
37+
const files = fs.readdirSync(`./dist/commands`).filter((file) => file.endsWith(".js"));
3438

35-
for(const file of files) {
39+
for (const file of files) {
3640
const command = require(`../${file}`);
3741

38-
if(command.name) {
39-
if(!command.enabled) continue;
42+
if (command.name) {
43+
if (!command.enabled) continue;
4044

41-
if(command.default_member_permissions) {
42-
if(!interaction.member.permissions.has(command.default_member_permissions)) continue;
45+
if (command.default_member_permissions) {
46+
if (!interaction.member.permissions.has(command.default_member_permissions)) continue;
4347
}
4448

4549
commands.push(command.name);
@@ -50,16 +54,16 @@ const command: Command = {
5054
}
5155

5256
async function pushDir(dir: String) {
53-
const files = fs.readdirSync(`./dist/commands/${dir}`).filter(file => file.endsWith(".js"));
57+
const files = fs.readdirSync(`./dist/commands/${dir}`).filter((file) => file.endsWith(".js"));
5458

55-
for(const file of files) {
59+
for (const file of files) {
5660
const command = require(`../${dir}/${file}`);
5761

58-
if(command.name) {
59-
if(!command.enabled) continue;
62+
if (command.name) {
63+
if (!command.enabled) continue;
6064

61-
if(command.default_member_permissions) {
62-
if(!interaction.member.permissions.has(command.default_member_permissions)) continue;
65+
if (command.default_member_permissions) {
66+
if (!interaction.member.permissions.has(command.default_member_permissions)) continue;
6367
}
6468

6569
commands.push(command.name);
@@ -70,52 +74,61 @@ const command: Command = {
7074
}
7175

7276
await pushRoot();
73-
(await getDirs("./dist/commands")).forEach(dir => pushDir(dir));
77+
(await getDirs("./dist/commands")).forEach((dir) => pushDir(dir));
7478

7579
const cmds = [];
7680

77-
for(const cmd of commands) {
81+
for (const cmd of commands) {
7882
const info = client.commands.get(cmd);
7983

8084
cmds.push(`</${cmd}:${client.commandIds.get(cmd)}>\n${emoji.reply} ${info.description}`);
8185
}
8286

8387
const help = new Discord.EmbedBuilder()
8488
.setColor(client.config.embeds.default as ColorResolvable)
85-
.setThumbnail(client.user?.displayAvatarURL({ extension: "png", forceStatic: false }))
89+
.setThumbnail(
90+
client.user?.displayAvatarURL({
91+
extension: "png",
92+
forceStatic: false
93+
})
94+
)
8695
.setTitle("Commands")
8796
.setDescription(cmds.sort().join("\n"))
88-
.setTimestamp()
97+
.setTimestamp();
8998

9099
// If a command was specified, get info on that command
91100
const command = client.commands.get(cmd);
92101

93-
if(command) {
94-
if(!command.enabled) return await interaction.editReply({ embeds: [help] });
102+
if (command) {
103+
if (!command.enabled) return await interaction.editReply({ embeds: [help] });
95104

96105
const description = command.description ?? "N/A";
97-
const botPermissions = command.botPermissions.length ? `\`${command.botPermissions.join("\`, \`")}\`` : "N/A";
98-
const cooldown = command.cooldown ? `${command.cooldown} second${command.cooldown === 1 ? "" : "s"}` : "None";
106+
const botPermissions = command.botPermissions.length
107+
? `\`${command.botPermissions.join("`, `")}\``
108+
: "N/A";
109+
const cooldown = command.cooldown
110+
? `${command.cooldown} second${command.cooldown === 1 ? "" : "s"}`
111+
: "None";
99112

100113
const commandHelp = new Discord.EmbedBuilder()
101114
.setColor(client.config.embeds.default as ColorResolvable)
102115
.setTitle(`Command: ${command.name}`)
103-
.addFields (
116+
.addFields(
104117
{ name: "Description", value: description },
105118
{ name: "Cooldown", value: cooldown },
106119
{ name: "Bot Permissions", value: botPermissions }
107120
)
108-
.setTimestamp()
121+
.setTimestamp();
109122

110123
await interaction.editReply({ embeds: [commandHelp] });
111124
return;
112125
}
113126

114127
await interaction.editReply({ embeds: [help] });
115-
} catch(err) {
128+
} catch (err) {
116129
client.logCommandError(err, interaction, Discord);
117130
}
118131
}
119-
}
132+
};
120133

121134
export = command;

src/commands/info/ping.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ const command: Command = {
1414
enabled: true,
1515
deferReply: false,
1616
ephemeral: true,
17-
async execute(interaction: ChatInputCommandInteraction, client: ExtendedClient, Discord: typeof import("discord.js")) {
17+
async execute(
18+
interaction: ChatInputCommandInteraction,
19+
client: ExtendedClient,
20+
Discord: typeof import("discord.js")
21+
) {
1822
try {
1923
// Get ping
2024
const botLatency = Date.now() - interaction.createdTimestamp;
@@ -24,35 +28,41 @@ const command: Command = {
2428
let apiLatencyValue;
2529

2630
// Set which connection emoji to use for botLatency
27-
if(botLatency >= 0 && botLatency <= 99) {
31+
if (botLatency >= 0 && botLatency <= 99) {
2832
botLatencyValue = `${emoji.connection_excellent} ${botLatency}ms`;
29-
} else if(botLatency >= 100 && botLatency <= 199) {
33+
} else if (botLatency >= 100 && botLatency <= 199) {
3034
botLatencyValue = `${emoji.connection_good} ${botLatency}ms`;
3135
} else {
3236
botLatencyValue = `${emoji.connection_bad} ${botLatency}ms`;
3337
}
3438

3539
// Set which connection emoji to use for apiLatency
36-
if(apiLatency >= 0 && apiLatency <= 99) {
40+
if (apiLatency >= 0 && apiLatency <= 99) {
3741
apiLatencyValue = `${emoji.connection_excellent} ${apiLatency}ms`;
38-
} else if(apiLatency >= 100 && apiLatency <= 199) {
42+
} else if (apiLatency >= 100 && apiLatency <= 199) {
3943
apiLatencyValue = `${emoji.connection_good} ${apiLatency}ms`;
4044
} else {
4145
apiLatencyValue = `${emoji.connection_bad} ${apiLatency}ms`;
4246
}
4347

44-
const ping = new Discord.EmbedBuilder()
45-
.setColor(client.config.embeds.default as ColorResolvable)
46-
.addFields (
47-
{ name: "Bot Latency", value: botLatencyValue, inline: true },
48-
{ name: "API Latency", value: apiLatencyValue, inline: true }
49-
)
48+
const ping = new Discord.EmbedBuilder().setColor(client.config.embeds.default as ColorResolvable).addFields(
49+
{
50+
name: "Bot Latency",
51+
value: botLatencyValue,
52+
inline: true
53+
},
54+
{
55+
name: "API Latency",
56+
value: apiLatencyValue,
57+
inline: true
58+
}
59+
);
5060

5161
await interaction.reply({ embeds: [ping], ephemeral: true });
52-
} catch(err) {
62+
} catch (err) {
5363
client.logCommandError(err, interaction, Discord);
5464
}
5565
}
56-
}
66+
};
5767

5868
export = command;

0 commit comments

Comments
 (0)