-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4dd3008
commit aca6352
Showing
2 changed files
with
50 additions
and
1 deletion.
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
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,48 @@ | ||
const path = require('path'); | ||
const { ExtendedClient, ConfigProvider } = require('@greencoast/discord.js-extended'); | ||
const logger = require('@greencoast/logger'); | ||
|
||
const config = new ConfigProvider({ | ||
env: process.env, | ||
configPath: path.join(__dirname, '../config/settings.json'), | ||
types: { | ||
TOKEN: 'string' | ||
} | ||
}); | ||
|
||
const client = new ExtendedClient({ | ||
config, | ||
intents: [] | ||
}); | ||
|
||
client.registry | ||
.registerGroups([ | ||
['all-tts', 'All TTS Commands'], | ||
['config', 'Configuration Commands'], | ||
['google-tts', 'Google TTS Commands'], | ||
['other-tts', 'Other TTS Commands'], | ||
['misc', 'Miscellaneous Commands'] | ||
]) | ||
.registerCommandsIn(path.join(__dirname, './commands')); | ||
|
||
client.on('ready', async() => { | ||
try { | ||
client.deployer.rest.setToken(config.get('TOKEN')); | ||
await client.deployer.deployGlobally(); | ||
} catch (error) { | ||
logger.error('Something happened when trying to deploy the commands globally.', error); | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
client.on('commandsDeployed', (commands) => { | ||
commands.forEach((command) => { | ||
logger.info(`Successfully deployed ${command.name} command globally!`); | ||
}); | ||
|
||
logger.info(`Finished deploying ${commands.length} commands globally. These changes can take up to an hour to be reflected on Discord.`); | ||
|
||
process.exit(0); | ||
}); | ||
|
||
client.login(config.get('TOKEN')); |