File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed
Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -42,19 +42,22 @@ export default async () => {
4242 console . log ( commands ) ;
4343
4444 // Use this when in development phase
45- await rest . put (
46- Routes . applicationGuildCommands (
47- env . DISCORD_CLIENT_ID ,
48- env . DISCORD_DEV_GUILD_ID
49- ) ,
50- {
45+ if ( env . NODE_ENV === 'development' ) {
46+ await rest . put (
47+ Routes . applicationGuildCommands (
48+ env . DISCORD_CLIENT_ID ,
49+ env . DISCORD_DEV_GUILD_ID
50+ ) ,
51+ {
52+ body : commands ,
53+ }
54+ ) ;
55+ } else if ( env . NODE_ENV === 'production' ) {
56+ if ( ! client . isReady ( ) ) return ;
57+ await rest . put ( Routes . applicationCommands ( client . user . id ) , {
5158 body : commands ,
52- }
53- ) ;
54-
55- // await rest.put(Routes.applicationCommands(client.user.id), {
56- // body: commands,
57- // });
59+ } ) ;
60+ }
5861
5962 console . log ( 'Successfully reloaded application (/) commands.' ) ;
6063 } catch ( error ) {
Original file line number Diff line number Diff line change 11import { createEnv } from '@t3-oss/env-core' ;
22import { z } from 'zod' ;
33
4+ const nodeEnvs = [ 'production' , 'development' ] as const ;
5+
46export const env = createEnv ( {
57 isServer : true ,
68 server : {
79 DISCORD_TOKEN : z . string ( ) . min ( 1 ) ,
8- DISCORD_CLIENT_ID : z . string ( ) . min ( 1 ) ,
9- DISCORD_DEV_GUILD_ID : z . string ( ) . min ( 1 ) ,
10- DISCORD_CLIENT_SECRET : z . string ( ) . min ( 1 ) ,
10+ DISCORD_CLIENT_ID : z . string ( ) ,
11+ DISCORD_DEV_GUILD_ID : z . string ( ) ,
12+ DISCORD_CLIENT_SECRET : z . string ( ) ,
1113 DISCORD_REDIRECT_URI : z . string ( ) . url ( ) . min ( 1 ) ,
1214
1315 DISCORD_ADMIN_ID : z . string ( ) . min ( 1 ) ,
@@ -26,6 +28,7 @@ export const env = createEnv({
2628 GAME_DE : z . string ( ) . url ( ) . optional ( ) ,
2729 GAME_DE_USERNAME : z . string ( ) . min ( 1 ) ,
2830 GAME_DE_PASSWORD : z . string ( ) . min ( 1 ) ,
31+ NODE_ENV : z . enum ( nodeEnvs ) ,
2932 } ,
3033 runtimeEnv : {
3134 ...process . env ,
You can’t perform that action at this time.
0 commit comments