Skip to content

Commit 2d1afa3

Browse files
committed
use 4 spaces for indentation
1 parent d660a60 commit 2d1afa3

File tree

11 files changed

+143
-141
lines changed

11 files changed

+143
-141
lines changed

.devcontainer/devcontainer.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"name": "Codercord",
3-
"image": "oven/bun:debian",
4-
"features": {
5-
"ghcr.io/devcontainers/features/git:1": {},
6-
"ghcr.io/devcontainers/features/github-cli:1": {},
7-
"ghcr.io/devcontainers/features/common-utils:2": {}
8-
},
9-
"customizations": {
10-
"vscode": {
11-
"extensions": ["oven.bun-vscode", "biomejs.biome"],
12-
"settings": {
13-
"editor.defaultFormatter": "biomejs.biome",
14-
"editor.formatOnSave": true
15-
}
16-
}
17-
},
18-
"postCreateCommand": "bun install",
19-
"remoteUser": "codercord"
2+
"name": "Codercord",
3+
"image": "oven/bun:debian",
4+
"features": {
5+
"ghcr.io/devcontainers/features/git:1": {},
6+
"ghcr.io/devcontainers/features/github-cli:1": {},
7+
"ghcr.io/devcontainers/features/common-utils:2": {}
8+
},
9+
"customizations": {
10+
"vscode": {
11+
"extensions": ["oven.bun-vscode", "biomejs.biome"],
12+
"settings": {
13+
"editor.defaultFormatter": "biomejs.biome",
14+
"editor.formatOnSave": true
15+
}
16+
}
17+
},
18+
"postCreateCommand": "bun install",
19+
"remoteUser": "codercord"
2020
}

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["oven.bun-vscode", "biomejs.biome"]
2+
"recommendations": ["oven.bun-vscode", "biomejs.biome"]
33
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"editor.defaultFormatter": "biomejs.biome"
2+
"editor.defaultFormatter": "biomejs.biome"
33
}

assets/tags.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"no_programming": "This is is **NOT** a programming help server !\nYou are looking at the <https://coder.com> discord server, which is a product that lets you use remote machines as development environments.\n\nyou can ask programming-related questions at <https://discord.gg/code> or <https://discord.gg/programming>",
3-
"post_status": "You can close posts by running ``/close`` or reopen them by runing ``/reopen``"
2+
"no_programming": "This is is **NOT** a programming help server !\nYou are looking at the <https://coder.com> discord server, which is a product that lets you use remote machines as development environments.\n\nyou can ask programming-related questions at <https://discord.gg/code> or <https://discord.gg/programming>",
3+
"post_status": "You can close posts by running ``/close`` or reopen them by runing ``/reopen``"
44
}

biome.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"files": {
7-
"ignore": ["dist/**", "node_modules/**", "bun.lockdb"]
8-
},
9-
"formatter": {
10-
"indentWidth": 2,
11-
"indentStyle": "space",
12-
"lineWidth": 80
13-
},
14-
"linter": {
15-
"enabled": true,
16-
"rules": {
17-
"recommended": true
2+
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"files": {
7+
"ignore": ["dist/**", "node_modules/**", "bun.lockdb"]
8+
},
9+
"formatter": {
10+
"indentWidth": 4,
11+
"indentStyle": "space",
12+
"lineWidth": 80
13+
},
14+
"linter": {
15+
"enabled": true,
16+
"rules": {
17+
"recommended": true
18+
}
1819
}
19-
}
2020
}

package.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"name": "codercord",
3-
"version": "2.0.0",
4-
"description": "A Discord bot for our community server",
5-
"main": "dist/index.js",
6-
"type": "module",
7-
"scripts": {
8-
"build": "bunx rimraf dist && bunx tsc",
9-
"format": "bunx @biomejs/biome format --write",
10-
"format:ci": "bunx @biomejs/biome format --reporter=github",
11-
"lint": "bunx @biomejs/biome lint --write",
12-
"lint:ci": "bunx @biomejs/biome lint --reporter=github"
13-
},
14-
"keywords": [],
15-
"author": "github.com/coder",
16-
"license": "CC0-1.0",
17-
"devDependencies": {
18-
"@biomejs/biome": "1.8.2",
19-
"@eslint/compat": "1.1.0",
20-
"@eslint/js": "9.5.0",
21-
"@types/eslint__js": "8.42.3",
22-
"@types/node": "20.14.8",
23-
"eslint": "9.5.0",
24-
"rimraf": "5.0.7",
25-
"typescript": "5.5.2",
26-
"typescript-eslint": "7.13.1"
27-
},
28-
"dependencies": {
29-
"@uwu/configmasher": "2.0.0",
30-
"discord.js": "14.15.3"
31-
}
2+
"name": "codercord",
3+
"version": "2.0.0",
4+
"description": "A Discord bot for our community server",
5+
"main": "dist/index.js",
6+
"type": "module",
7+
"scripts": {
8+
"build": "bunx rimraf dist && bunx tsc",
9+
"format": "bunx @biomejs/biome format --write",
10+
"format:ci": "bunx @biomejs/biome format --reporter=github",
11+
"lint": "bunx @biomejs/biome lint --write",
12+
"lint:ci": "bunx @biomejs/biome lint --reporter=github"
13+
},
14+
"keywords": [],
15+
"author": "github.com/coder",
16+
"license": "CC0-1.0",
17+
"devDependencies": {
18+
"@biomejs/biome": "1.8.2",
19+
"@eslint/compat": "1.1.0",
20+
"@eslint/js": "9.5.0",
21+
"@types/eslint__js": "8.42.3",
22+
"@types/node": "20.14.8",
23+
"eslint": "9.5.0",
24+
"rimraf": "5.0.7",
25+
"typescript": "5.5.2",
26+
"typescript-eslint": "7.13.1"
27+
},
28+
"dependencies": {
29+
"@uwu/configmasher": "2.0.0",
30+
"discord.js": "14.15.3"
31+
}
3232
}

src/commands/index.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ import fs from "node:fs/promises";
22
import path from "node:path";
33

44
export async function loadCommands(): Promise<Map<string, unknown>> {
5-
const commands = new Map();
5+
const commands = new Map();
66

7-
const foldersPath = path.join(__dirname, "commands");
8-
const commandFolders = await fs.readdir(foldersPath);
7+
const foldersPath = path.join(__dirname, "commands");
8+
const commandFolders = await fs.readdir(foldersPath);
99

10-
for (const folder of commandFolders) {
11-
const commandsPath = path.join(foldersPath, folder);
12-
const commandFiles = await fs
13-
.readdir(commandsPath)
14-
.then((files) => files.filter((file) => file.endsWith(".js")));
10+
for (const folder of commandFolders) {
11+
const commandsPath = path.join(foldersPath, folder);
12+
const commandFiles = await fs
13+
.readdir(commandsPath)
14+
.then((files) => files.filter((file) => file.endsWith(".js")));
1515

16-
for (const file of commandFiles) {
17-
const filePath = path.join(commandsPath, file);
18-
const command = await import(filePath);
16+
for (const file of commandFiles) {
17+
const filePath = path.join(commandsPath, file);
18+
const command = await import(filePath);
1919

20-
if ("data" in command && "execute" in command) {
21-
commands.set(command.data.name, command);
22-
} else {
23-
throw new Error(
24-
`The command at ${filePath} is missing a required "data" or "execute" property.`,
25-
);
26-
}
20+
if ("data" in command && "execute" in command) {
21+
commands.set(command.data.name, command);
22+
} else {
23+
throw new Error(
24+
`The command at ${filePath} is missing a required "data" or "execute" property.`,
25+
);
26+
}
27+
}
2728
}
28-
}
2929

30-
return commands;
30+
return commands;
3131
}

src/commands/util/walkthrough.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { SlashCommandBuilder } from "discord.js";
22

33
export default {
4-
data: new SlashCommandBuilder()
5-
.setName("ping")
6-
.setDescription("Replies with Pong!"),
4+
data: new SlashCommandBuilder()
5+
.setName("ping")
6+
.setDescription("Replies with Pong!"),
77

8-
async execute(interaction) {
9-
await interaction.reply("Pong!");
10-
},
8+
async execute(interaction) {
9+
await interaction.reply("Pong!");
10+
},
1111
};

src/index.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,37 @@ const client = new Client({ intents: [] });
77
const commands = await loadCommands();
88

99
client.on(Events.InteractionCreate, async (interaction) => {
10-
if (!interaction.isChatInputCommand()) return;
11-
const command = commands.get(interaction.commandName);
12-
13-
if (!command) {
14-
console.error(`No command matching ${interaction.commandName} was found.`);
15-
return;
16-
}
17-
18-
try {
19-
await command.execute(interaction);
20-
} catch (error) {
21-
console.error(error);
22-
23-
if (interaction.replied || interaction.deferred) {
24-
await interaction.followUp({
25-
content: "There was an error while executing this command!",
26-
ephemeral: true,
27-
});
28-
} else {
29-
await interaction.reply({
30-
content: "There was an error while executing this command!",
31-
ephemeral: true,
32-
});
10+
if (!interaction.isChatInputCommand()) return;
11+
const command = commands.get(interaction.commandName);
12+
13+
if (!command) {
14+
console.error(
15+
`No command matching ${interaction.commandName} was found.`,
16+
);
17+
return;
18+
}
19+
20+
try {
21+
await command.execute(interaction);
22+
} catch (error) {
23+
console.error(error);
24+
25+
if (interaction.replied || interaction.deferred) {
26+
await interaction.followUp({
27+
content: "There was an error while executing this command!",
28+
ephemeral: true,
29+
});
30+
} else {
31+
await interaction.reply({
32+
content: "There was an error while executing this command!",
33+
ephemeral: true,
34+
});
35+
}
3336
}
34-
}
3537
});
3638

3739
client.once(Events.ClientReady, () => {
38-
console.log(`Logged in as ${client.user?.tag}!`);
40+
console.log(`Logged in as ${client.user?.tag}!`);
3941
});
4042

4143
client.login(config.token);

src/lib/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import loadConfig from "@uwu/configmasher";
22

33
interface Config {
4-
token: string;
4+
token: string;
55
}
66

77
export const { config, layers } = await loadConfig<Config>({
8-
name: "Codercord",
8+
name: "Codercord",
99

10-
environmentFile: true,
11-
processEnvironment: true,
10+
environmentFile: true,
11+
processEnvironment: true,
1212

13-
caseInsensitive: true,
13+
caseInsensitive: true,
1414

15-
defaults: {},
16-
mandatory: ["token"],
15+
defaults: {},
16+
mandatory: ["token"],
1717
});

tsconfig.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"module": "NodeNext",
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"module": "NodeNext",
55

6-
"declaration": false,
6+
"declaration": false,
77

8-
"moduleResolution": "NodeNext",
9-
"noImplicitAny": false,
8+
"moduleResolution": "NodeNext",
9+
"noImplicitAny": false,
1010

11-
"allowSyntheticDefaultImports": true,
11+
"allowSyntheticDefaultImports": true,
1212

13-
"sourceMap": false,
14-
"outDir": "dist",
13+
"sourceMap": false,
14+
"outDir": "dist",
1515

16-
"rootDir": "src",
17-
"baseUrl": "src"
18-
},
16+
"rootDir": "src",
17+
"baseUrl": "src"
18+
},
1919

20-
"include": ["src/**/*.ts"],
21-
"exclude": ["dist"]
20+
"include": ["src/**/*.ts"],
21+
"exclude": ["dist"]
2222
}

0 commit comments

Comments
 (0)