Skip to content

Commit

Permalink
feat(docs): add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
1chiSensei committed Apr 30, 2021
1 parent 67ccd52 commit 51d7a16
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
typings/
docs/
public/
.yarn/
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
publish_dir: ./public
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pids
.tmp/
dist
typings
docs
public
test/config.js

# yarn v2
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
typings/
docs/
public/
.github/workflows
.yarn/
12 changes: 6 additions & 6 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-berry.cjs
40 changes: 40 additions & 0 deletions docs/EXAMPLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Example Bot

Here's an example bot that you can use.

```js
const { Client } = require('dogehq');

const client = new Client();
const config = {
token: 'your_token_here',
refreshToken: 'your_refresh_token_here',
prefix: 'your_preffered_prefix_here',
};

// when the client is ready
client.once('ready', () => {
console.log('Ready!');

// join the top room
client.rooms.first().join();
});

client.on('message', (message) => {
if (!message.content.startsWith(config.prefix)) return; // if the message doesn't start with the prefix, dont respond

const args = message.content.slice(config.prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();

if (command === 'ping') {
message.room.send('Pong!');
} else if (command === 'pong') {
message.room.send('Ping!');
} else if (command === 'food') {
if (args.length === 0) return; // if the argument isnt there, dont respond
message.room.send(`You like ${args[0]}? I like it too!`);
}
});

client.login(config.token, config.refreshToken);
```
20 changes: 20 additions & 0 deletions docs/INSTALLING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Installing

## Prequisites

- Node.js v14 or later
- A node package manager (npm, yarn, etc.)

## Installation

> NPM
```sh
npm install dogehq
```

> Yarn
```sh
yarn add dogehq
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dogehq",
"version": "1.4.1",
"version": "1.5.0",
"description": "A wrapper for the DogeHouse Kebab API Client.",
"main": "./dist/index.js",
"types": "./dist/",
Expand All @@ -26,7 +26,7 @@
},
"license": "Apache-2.0",
"scripts": {
"docs": "rimraf docs && typedoc ./src/index.ts --theme ./node_modules/typedoc-vortex-theme/bin/default",
"docs": "rimraf public && typedoc",
"build": "tsc",
"lint": "eslint . --fix",
"prettier": "prettier . --write",
Expand All @@ -52,7 +52,7 @@
"rimraf": "^3.0.2",
"tslib": "^2.2.0",
"typedoc": "^0.20.36",
"typedoc-vortex-theme": "^0.0.2",
"typedoc-plugin-pages-fork": "^0.0.1",
"typescript": "^4.2.4"
}
}
17 changes: 17 additions & 0 deletions pagesconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"groups": [
{
"title": "Getting Started",
"pages": [
{
"title": "Installing",
"source": "./docs/INSTALLING.md"
},
{
"title": "Example Bot",
"source": "./docs/EXAMPLE.md"
}
]
}
]
}
6 changes: 6 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://typedoc.org/schema.json",
"out": "public",
"entryPoints": ["src/index.ts"],
"theme": "pages-plugin"
}
31 changes: 25 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ __metadata:
languageName: node
linkType: hard

"compare-versions@npm:^3.6.0":
version: 3.6.0
resolution: "compare-versions@npm:3.6.0"
checksum: 09525264502bda1f6667ad2429eaf5520b543d997e79e7a94b66a5896df8921cdc3a97140dfff75af6c9ba1859c872de1921c3cf8a6c48ed807bbf9f582cf093
languageName: node
linkType: hard

"concat-map@npm:0.0.1":
version: 0.0.1
resolution: "concat-map@npm:0.0.1"
Expand Down Expand Up @@ -527,7 +534,7 @@ __metadata:
rimraf: ^3.0.2
tslib: ^2.2.0
typedoc: ^0.20.36
typedoc-vortex-theme: ^0.0.2
typedoc-plugin-pages-fork: ^0.0.1
typescript: ^4.2.4
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -1211,7 +1218,7 @@ __metadata:
languageName: node
linkType: hard

"lunr@npm:^2.3.9":
"lunr@npm:^2.3.8, lunr@npm:^2.3.9":
version: 2.3.9
resolution: "lunr@npm:2.3.9"
checksum: a2b66320c2f6632322b91c43621eed9e623c0f1b81e7c2d74c238884a02229698baa4478bd238e9b32d7abf0db5ae9233b311c28e1edbcc481774e1ce83bec6f
Expand Down Expand Up @@ -1735,17 +1742,29 @@ resolve@^1.1.6:
languageName: node
linkType: hard

"typedoc-default-themes@npm:^0.10.1":
version: 0.10.2
resolution: "typedoc-default-themes@npm:0.10.2"
dependencies:
lunr: ^2.3.8
checksum: 8766471937395067504b3f21edd8c9f89e6901c2912aff0b4371a5dfceea31e4a1f9d08282c2998d0bc0a70e3d6943b3043ebe90e6b11dfdaf52c4a05e32d980
languageName: node
linkType: hard

"typedoc-default-themes@npm:^0.12.10":
version: 0.12.10
resolution: "typedoc-default-themes@npm:0.12.10"
checksum: 3a420c405b00122c20018762ce145186219f26651a051216b1d4dafa1b3756a7e47290bf27898d3e2769af3a0da44591e3c93268c2a6503fcf28eb8b0f32980b
languageName: node
linkType: hard

"typedoc-vortex-theme@npm:^0.0.2":
version: 0.0.2
resolution: "typedoc-vortex-theme@npm:0.0.2"
checksum: 575f7c74ae73ce5c35fa99031bca2eb5745f45c3548833aea4ebfbf2a57e872039fec842e43d98c165c6875d1c84adbe3db6d1a1811c3ebaf0fedde663e35ada
"typedoc-plugin-pages-fork@npm:^0.0.1":
version: 0.0.1
resolution: "typedoc-plugin-pages-fork@npm:0.0.1"
dependencies:
compare-versions: ^3.6.0
typedoc-default-themes: ^0.10.1
checksum: 4f706abe6519ffd7fbf6796439dc0c5c11c84469b2f37bfc0b552be51e82209002fabb8bb349c18019d5bdc1989038485947ccd210f9fa57a8079108cb58febc
languageName: node
linkType: hard

Expand Down

0 comments on commit 51d7a16

Please sign in to comment.