Skip to content

Commit

Permalink
Merge pull request #66 from appujet/new-docs
Browse files Browse the repository at this point in the history
added new-docs
  • Loading branch information
Tomato6966 authored Sep 24, 2024
2 parents 27ddc33 + 0b842e8 commit bad2e18
Show file tree
Hide file tree
Showing 22 changed files with 897 additions and 17 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy to GitHub Pages

on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ cleanup-everything-new-docs ] # for now only
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install --no-frozen-lockfile

- name: Deploy to GitHub Pages with Astro
uses: withastro/action@v3
with:
path: ./docs
node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
package-manager: npm

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ testBot/package-lock.json
bun.lockb
yarn.lock
package-lock.json
pnpm-lock.yaml
dist
26 changes: 26 additions & 0 deletions new-docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# lockfiles
package-lock.json
yarn.lock
pnpm-lock.yaml
55 changes: 55 additions & 0 deletions new-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Starlight Starter Kit: Basics

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

```
npm create astro@latest -- --template starlight
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## 🚀 Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

```
.
├── public/
├── src/
│ ├── assets/
│ ├── content/
│ │ ├── docs/
│ │ └── config.ts
│ └── env.d.ts
├── astro.config.mjs
├── package.json
└── tsconfig.json
```

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name.

Images can be added to `src/assets/` and embedded in Markdown with a relative link.

Static assets, like favicons, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
95 changes: 95 additions & 0 deletions new-docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightTypeDoc, { typeDocSidebarGroup } from 'starlight-typedoc'

// https://astro.build/config
export default defineConfig({
site: 'https://tomato6966.github.io/lavalink-client/',
base: '/',
integrations: [
starlight({
title: 'Lavalink Client',
social: {
github: 'https://github.com/Tomato6966/lavalink-client',
//discord: 'https://discord.gg/',
},
editLink: {
baseUrl: 'https://github.com/Tomato6966/lavalink-client/tree/main',
},
plugins: [
// Generate the documentation.
starlightTypeDoc({
entryPoints: ['../src/index.ts'],
tsconfig: '../tsconfig.json',
typeDoc: {
useCodeBlocks: true,
parametersFormat: 'table',
propertiesFormat: 'table',
enumMembersFormat: 'table',
typeDeclarationFormat: 'table',
indexFormat: 'table',
expandParameters: true,
name: 'Lavalink Client',
},
pagination: true,
}),
],
sidebar: [
{
label: 'Getting Started',
collapsed: true,
items: [
{
label: 'installation',
link: '/home/installation',
},
{
label: 'Features',
link: '/home/features',
},
{
label: 'Example Guide',
link: '/home/example',
},
{
label: 'Sample Configuration',
link: '/home/configuration',
}
],
},
{
label: 'Extra',
collapsed: true,
items: [
{
label: 'Manager Events',
link: '/extra/manager-events',
},
{
label: 'Node Events',
link: '/extra/node-events',
},
{
label: 'Resuming',
link: '/extra/resuming',
}
]
},
typeDocSidebarGroup,
{
label: 'GitHub',
link: 'https://github.com/Tomato6966/lavalink-client',
},
{
label: 'NPM',
link: 'https://npmjs.com/lavalink-client',
},
{
label: 'Example Bot',
link: 'https://github.com/Tomato6966/lavalink-client/tree/main/testBot',
},
],
}),
],
});
22 changes: 22 additions & 0 deletions new-docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "docs",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/starlight": "^0.28.2",
"astro": "^4.15.3",
"sharp": "^0.32.5",
"starlight-typedoc": "^0.16.0",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.7",
"typescript": "^5.6.2"
}
}
1 change: 1 addition & 0 deletions new-docs/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added new-docs/src/assets/houston.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions new-docs/src/components/version.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
import { version } from '../../../package.json';
---

<code class="version">v{version}</code>
6 changes: 6 additions & 0 deletions new-docs/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};
62 changes: 62 additions & 0 deletions new-docs/src/content/docs/extra/manager-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
editUrl: false
next: true
prev: true
title: Manager Events
description: "All Events of the Lavalink Manager."
---

## Player Related Logs

> *Monitor player activities and changes:*
- **`playerCreate`** ➡️ `(player) => {}`
*Triggered when a player is created.*

- **`playerDestroy`** ➡️ `(player, reason) => {}`
*Triggered when a player is destroyed. Reason for destruction provided.*

- **`playerDisconnect`** ➡️ `(player, voiceChannelId) => {}`
*Triggered when a player disconnects from a voice channel.*

- **`playerMove`** ➡️ `(player, oldChannelId, newChannelId) => {}`
*Triggered when a player moves from one channel to another.*
*Updating the voice channel is handled automatically by the client.*

- **`playerSocketClosed`** ➡️ `(player, payload) => {}`
*Triggered when the player’s socket is closed.*

## Track / Manager Related Logs

> *Handle track events and manage playback:*
- **`trackStart`** ➡️ `(player, track, payload) => {}`
*Triggered when a track starts playing.*

- **`trackStuck`** ➡️ `(player, track, payload) => {}`
*Triggered when a track gets stuck (e.g., playback halts).*

- **`trackError`** ➡️ `(player, track, payload) => {}`
*Triggered when an error occurs during track playback.*

- **`trackEnd`** ➡️ `(player, track, payload) => {}`
*Triggered when a track finishes playing.*

- **`queueEnd`** ➡️ `(player, track, payload) => {}`
*Triggered when the queue ends.*

- **`playerUpdate`** ➡️ `(player) => {}`
*Triggered when the player is updated.*

## Examples

```js
client.lavalink.on("create", (node, payload) => {
console.log(`The Lavalink Node #${node.id} connected`);
});

// For all node-based errors:
client.lavalink.on("error", (node, error, payload) => {
console.error(`The Lavalink Node #${node.id} errored: `, error);
console.error(`Error Payload: `, payload);
});
49 changes: 49 additions & 0 deletions new-docs/src/content/docs/extra/node-events.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
editUrl: false
next: true
prev: true
title: Node Events
description: "All Events of the Lavalink Node."
---

## Node-Manager Events

> *Monitor and manage Lavalink nodes:*
- **`raw`** ➡️ `(node, payload) => {}`
*Triggered when raw data is received from the node.*

- **`disconnect`** ➡️ `(node, reason) => {}`
*Triggered when the node disconnects. Reason for disconnection is provided.*

- **`connect`** ➡️ `(node) => {}`
*Triggered when the node successfully connects.*

- **`reconnecting`** ➡️ `(node) => {}`
*Triggered when the node is attempting to reconnect.*

- **`create`** ➡️ `(node) => {}`
*Triggered when a new node is created.*

- **`destroy`** ➡️ `(node) => {}`
*Triggered when a node is destroyed.*

- **`error`** ➡️ `(node, error, payload) => {}`
*Triggered when an error occurs with the node.*

- **`resumed`** ➡️ `(node, payload, players) => {}`
*Triggered when the node resumes.*
*Resuming needs to be handled manually; ensure to add the players to the manager.*

## Example: Listening to Node Events

```js
client.lavalink.nodeManager.on("create", (node, payload) => {
console.log(`The Lavalink Node #${node.id} connected`);
});

// For all node-based errors:
client.lavalink.nodeManager.on("error", (node, error, payload) => {
console.error(`The Lavalink Node #${node.id} errored: `, error);
console.error(`Error Payload: `, payload);
});
Loading

0 comments on commit bad2e18

Please sign in to comment.