Skip to content

Commit d1f6a83

Browse files
committed
bump(0.0.3): moved api to typescript
1 parent f1b0757 commit d1f6a83

File tree

5 files changed

+108
-8
lines changed

5 files changed

+108
-8
lines changed

api/index.js renamed to api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ app.post('/admin/:guild/:action/:target', restrictToLocalhost, (req, res) => {
163163

164164
app.listen(PORT, () => {
165165
console.log(`Server running on http://localhost:${PORT}`);
166-
});
166+
});

bot/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ const commands: Record<string, Command> = {
194194
// Convert commands to a Map
195195
const commandsMap = new Map<string, Command>();
196196
for (const key in commands) {
197-
if (commands.hasOwnProperty(key)) {
197+
if (Object.prototype.hasOwnProperty.call(commands, key)) {
198198
const command = commands[key];
199199
console.log('loading ' + key);
200200
commandsMap.set(key, command);

bot/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// https://discord.com/oauth2/authorize?client_id=1245807579624378601&permissions=274878008384&scope=bot+applications.commands
2+
//TODO: Type this
23

34
// Check if DISCORD_TOKEN has been provided as an environment variable, and is a valid regex pattern
45
const discordToken: string | undefined = process.env?.DISCORD_TOKEN
@@ -24,8 +25,6 @@ const rest = new REST().setToken(discordToken)
2425
const getAppId: {id?: string | null} = await rest.get(Routes.currentApplication()) || { id: null }
2526
if (!getAppId?.id) throw 'No application ID was able to be found with this token'
2627

27-
//TODO: Type this
28-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2928
const data: any = await rest.put(
3029
Routes.applicationCommands(getAppId.id),
3130
{

package-lock.json

Lines changed: 101 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"type": "module",
44
"version": "0.0.2",
55
"scripts": {
6-
"api": "bun --watch api/index.js",
7-
"bot": "bun --watch bot/index.ts"
6+
"api": "bun --watch api/index.ts",
7+
"bot": "bun --watch bot/index.ts"
88
},
99
"devDependencies": {
1010
"@eslint/js": "^9.5.0",
1111
"@types/bun": "latest",
12+
"@types/cors": "^2.8.17",
1213
"@types/eslint__js": "^8.42.3",
14+
"@types/express": "^4.17.21",
1315
"typescript-eslint": "^7.14.1"
1416
},
1517
"peerDependencies": {

0 commit comments

Comments
 (0)