-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add command register script for vercel build
- Loading branch information
1 parent
fea1a5a
commit 900864b
Showing
7 changed files
with
155 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "discraft", | ||
"version": "1.6.5-beta.4", | ||
"version": "1.6.5-beta.5", | ||
"description": "Ultimate Discord bot framework", | ||
"type": "module", | ||
"packageManager": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { configDotenv } from "dotenv"; | ||
configDotenv(); | ||
|
||
import { | ||
REST, | ||
type RESTPostAPIApplicationCommandsJSONBody, | ||
Routes, | ||
} from "discord.js"; | ||
import commands from "../.discraft/commands/index.ts"; | ||
|
||
const token = process.env.DISCORD_TOKEN; | ||
const applicationId = process.env.DISCORD_APP_ID; | ||
|
||
if (!token) { | ||
console.error("DISCORD_TOKEN is not set in your environment variables."); | ||
process.exit(1); | ||
} | ||
if (!applicationId) { | ||
console.error("DISCORD_APP_ID is not set in your environment variables."); | ||
process.exit(1); | ||
} | ||
|
||
const rest = new REST({ version: "10" }).setToken(token); | ||
|
||
const commandData = Object.values(commands).map((command) => command.data); | ||
|
||
(async () => { | ||
try { | ||
console.log( | ||
`Started refreshing ${commandData.length} application (/) commands.`, | ||
); | ||
|
||
const data = (await rest.put(Routes.applicationCommands(applicationId), { | ||
body: commandData, | ||
})) as RESTPostAPIApplicationCommandsJSONBody[]; | ||
console.log( | ||
`Successfully reloaded ${data.length} application (/) commands.`, | ||
); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,5 @@ | |
"source": "/(.*)", | ||
"destination": "/api" | ||
} | ||
], | ||
"functions": { | ||
"api/index.js": { | ||
"maxDuration": 60 | ||
} | ||
} | ||
] | ||
} |