Skip to content

Commit

Permalink
chore(docs): More docs about tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Dec 17, 2020
1 parent ab06e21 commit 61f3306
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
12 changes: 10 additions & 2 deletions lib/creator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ interface SlashCreatorOptions {
applicationID: string;
/** The public key for your application */
publicKey: string;
/** The bot/client token for the application. Recommended to set. */
/**
* The bot/client token for the application.
* Recommended to set this in your config.
*/
token?: string;
/** The path where the server will listen for interactions. */
endpointPath?: string;
Expand Down Expand Up @@ -121,16 +124,21 @@ declare class SlashCreator extends SlashCreator_base {
withServer(server: Server): this;
/** Starts the server, if one was defined. */
startServer(): Promise<void>;
/** Sync all commands with Discord. This ensures that commands exist when handling them. */
/**
* Sync all commands with Discord. This ensures that commands exist when handling them.
* <warn>This requires you to have your token set in the creator config.</warn>
*/
syncCommands(opts?: SyncCommandOptions): this;
/**
* Sync guild commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param guildID The guild to sync
* @param deleteCommands Whether to delete command not found in the creator
*/
syncCommandsIn(guildID: string, deleteCommands?: boolean): Promise<void>;
/**
* Sync global commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param deleteCommands Whether to delete command not found in the creator
*/
syncGlobalCommands(deleteCommands?: boolean): Promise<void>;
Expand Down
7 changes: 6 additions & 1 deletion lib/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ class SlashCreator extends eventemitter3_1.default {
await this.server.listen(this.options.serverPort, this.options.serverHost);
this.emit('debug', 'Server started');
}
/** Sync all commands with Discord. This ensures that commands exist when handling them. */
/**
* Sync all commands with Discord. This ensures that commands exist when handling them.
* <warn>This requires you to have your token set in the creator config.</warn>
*/
syncCommands(opts) {
const options = Object.assign({
deleteCommands: true,
Expand Down Expand Up @@ -175,6 +178,7 @@ class SlashCreator extends eventemitter3_1.default {
}
/**
* Sync guild commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param guildID The guild to sync
* @param deleteCommands Whether to delete command not found in the creator
*/
Expand Down Expand Up @@ -213,6 +217,7 @@ class SlashCreator extends eventemitter3_1.default {
}
/**
* Sync global commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param deleteCommands Whether to delete command not found in the creator
*/
async syncGlobalCommands(deleteCommands = true) {
Expand Down
12 changes: 10 additions & 2 deletions src/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ interface SlashCreatorOptions {
applicationID: string;
/** The public key for your application */
publicKey: string;
/** The bot/client token for the application. Recommended to set. */
/**
* The bot/client token for the application.
* Recommended to set this in your config.
*/
token?: string;
/** The path where the server will listen for interactions. */
endpointPath?: string;
Expand Down Expand Up @@ -234,7 +237,10 @@ class SlashCreator extends ((EventEmitter as any) as new () => TypedEmitter<Slas
this.emit('debug', 'Server started');
}

/** Sync all commands with Discord. This ensures that commands exist when handling them. */
/**
* Sync all commands with Discord. This ensures that commands exist when handling them.
* <warn>This requires you to have your token set in the creator config.</warn>
*/
syncCommands(opts?: SyncCommandOptions) {
const options = Object.assign(
{
Expand Down Expand Up @@ -282,6 +288,7 @@ class SlashCreator extends ((EventEmitter as any) as new () => TypedEmitter<Slas

/**
* Sync guild commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param guildID The guild to sync
* @param deleteCommands Whether to delete command not found in the creator
*/
Expand Down Expand Up @@ -335,6 +342,7 @@ class SlashCreator extends ((EventEmitter as any) as new () => TypedEmitter<Slas

/**
* Sync global commands.
* <warn>This requires you to have your token set in the creator config.</warn>
* @param deleteCommands Whether to delete command not found in the creator
*/
async syncGlobalCommands(deleteCommands = true) {
Expand Down

0 comments on commit 61f3306

Please sign in to comment.