Skip to content

Commit

Permalink
fix(docs): update-tsdoc-for-vscode-may-2021 (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Jun 12, 2021
1 parent 3e00176 commit 857eaba
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 165 deletions.
File renamed without changes.
33 changes: 4 additions & 29 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,14 @@ on:
pull_request:

jobs:
pre_ci:
name: Prepare CI environment
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: '[Push] Get commit message'
if: github.event_name == 'push'
id: push_get_commit_message
run: echo ::set-output name=push_commit_message::$(git log --format=%B -n 1 HEAD)
- name: '[Pull Request] Get commit message'
if: github.event_name == 'pull_request'
id: pr_get_commit_message
run: echo ::set-output name=pr_commit_message::$(git log --format=%B -n 1 HEAD^2)
- name: Add problem matchers
run: |
echo "::add-matcher::.github/problemMatchers/tsc.json"
echo "::add-matcher::.github/problemMatchers/eslint-stylish.json"
outputs:
commit_message: $( [ -z "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" ] && echo "${{ steps.push_get_commit_message.outputs.push_commit_message }}" || echo "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" )

Linting:
name: Linting
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Add problem matcher
run: echo "::add-matcher::.github/problemMatchers/eslint.json"
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
Expand All @@ -57,8 +34,6 @@ jobs:
Testing:
name: Unit Tests
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
Expand Down Expand Up @@ -86,11 +61,11 @@ jobs:
Building:
name: Compile source code
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Add problem matcher
run: echo "::add-matcher::.github/problemMatchers/tsc.json"
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion guides/getting-started/CreatingCommands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = class extends Command {
async run(message) {
const msg = await message.channel.send('Ping?');
return msg.edit(
`Pong! Bot Latency ${Math.round(this.context.client.ws.ping)}ms. API Latency ${msg.createdTimestamp - message.createdTimestamp}ms.`
`Pong! Bot Latency ${Math.round(this.container.client.ws.ping)}ms. API Latency ${msg.createdTimestamp - message.createdTimestamp}ms.`
);
}
};
Expand Down
8 changes: 4 additions & 4 deletions guides/getting-started/CreatingEvents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = class extends Event {
}

async run() {
this.context.logger.log('The bot is up and running!');
this.container.logger.log('The bot is up and running!');
}
};
```
Expand All @@ -33,11 +33,11 @@ The first parameter of `super` is the context, that is given in the constructor.
whether it should only be run once (`once`). The emitter defaults to the the client, and the event name default to the
file name.

The `run` method is the method that gets called when the event occures. It takes whatever the events gives as argument.
The `run` method is the method that gets called when the event occurs. It takes whatever the events gives as argument.
In our case, the ready events gives no information so we don't need any parameter.

Every piece (events, commands etc) in sapphire has a <a href={pieceContextUrl}>context</a> which can be accessed via
`this.context`. It is this context that contains the logger, the client and other properties. Here we access the
logger via `this.context.logger` and call its `log` method to print a nicely formatted message in the console.
`this.container`. It is this container that contains the logger, the client and other properties. Here we access the
logger via `this.container.logger` and call its `log` method to print a nicely formatted message in the console.

If everything was done correctly, now, whenever you launch your bot, you will see a message in the console.
16 changes: 8 additions & 8 deletions src/lib/SapphireClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface SapphirePrefixHook {

export interface SapphireClientOptions {
/**
* The base user directory, if set to `null`, Sapphire will not call [[SapphireClient.registerUserDirectories]],
* The base user directory, if set to `null`, Sapphire will not call {@link SapphireClient.registerUserDirectories},
* meaning that you will need to manually set each folder for each store. Please read the aforementioned method's
* documentation for more information.
* @since 1.0.0
Expand Down Expand Up @@ -75,7 +75,7 @@ export interface SapphireClientOptions {
regexPrefix?: RegExp;

/**
* The prefix hook, by default it is a callback function that returns [[SapphireClientOptions.defaultPrefix]].
* The prefix hook, by default it is a callback function that returns {@link SapphireClientOptions.defaultPrefix}.
* @since 1.0.0
* @default () => client.options.defaultPrefix
*/
Expand All @@ -89,27 +89,27 @@ export interface SapphireClientOptions {
id?: string;

/**
* The logger options, defaults to an instance of [[Logger]] when [[ClientLoggerOptions.instance]] is not specified.
* The logger options, defaults to an instance of {@link Logger} when {@link ClientLoggerOptions.instance} is not specified.
* @since 1.0.0
* @default { instance: new Logger(LogLevel.Info) }
*/
logger?: ClientLoggerOptions;

/**
* If Sapphire should load our pre-included error event listeners that log any encountered errors to the [[SapphireClient.logger]] instance
* If Sapphire should load our pre-included error event listeners that log any encountered errors to the {@link SapphireClient.logger} instance
* @since 1.0.0
* @default true
*/
loadDefaultErrorEvents?: boolean;
}

/**
* The base [[Client]] extension that makes Sapphire work. When building a Discord bot with the framework, the developer
* The base {@link Client} extension that makes Sapphire work. When building a Discord bot with the framework, the developer
* must either use this class, or extend it.
*
* Sapphire also automatically detects the folders to scan for pieces, please read
* [[SapphireClient.registerUserDirectories]] for reference. This method is called at the start of the
* [[SapphireClient.login]] method.
* {@link SapphireClient.registerUserDirectories} for reference. This method is called at the start of the
* {@link SapphireClient.login} method.
*
* @see {@link SapphireClientOptions} for all options available to the Sapphire Client. You can also provide all of discord.js' [ClientOptions](https://discord.js.org/#/docs/main/stable/typedef/ClientOptions)
*
Expand Down Expand Up @@ -187,7 +187,7 @@ export class SapphireClient extends Client {
public fetchPrefix: SapphirePrefixHook;

/**
* The logger to be used by the framework and plugins. By default, a [[Logger]] instance is used, which emits the
* The logger to be used by the framework and plugins. By default, a {@link Logger} instance is used, which emits the
* messages to the console.
* @since 1.0.0
*/
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/ArgumentError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ArgumentError<T = unknown> extends UserError {
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace ArgumentError {
/**
* The options for [[ArgumentError]].
* The options for {@link ArgumentError}.
* @since 1.0.0
*/
export interface Options<T> extends Omit<UserError.Options, 'identifier'> {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/PreconditionError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PreconditionError extends UserError {
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace PreconditionError {
/**
* The options for [[PreconditionError]].
* The options for {@link PreconditionError}.
* @since 1.0.0
*/
export interface Options extends Omit<UserError.Options, 'identifier'> {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/UserError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class UserError extends Error {
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace UserError {
/**
* The options for [[UserError]].
* The options for {@link UserError}.
* @since 1.0.0
*/
export interface Options {
Expand Down
Loading

0 comments on commit 857eaba

Please sign in to comment.