1.0.3 • Published 3 years ago

@musicca/structs v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

About 📛

This package is a collection of structures for Musicca.

Installation 💾

npm install @musicca/structs
yarn add @musicca/structs
pnpm add @musicca/structs

Guide 🖋

Creating custom queue

First, you need to create a new queue class with your custom implementation

import { Queue, Media } from 'musicca';

export default class CustomQueue extends Queue {
  public list: Media[] = [];

  // Always put options at the 3rd parameter
  constructor(manager, id, options) { ... }

  // All custom methods are awaitable by default
  public all() { ... }
  public add<T extends Media | Media[] = Media>(media: T, position?: number) { ... }
  public get(position: number) { ... }
  public remove(position: number) { ... }
  public clear() { ... }
  public indexOf(media: Media) { ... }
}

Now, you can just plug it in to musicca

const client = new Musicca<CustomQueue>({
  plugins: { ... },
  structs: {
    queue: CustomQueue
  }
});

Links 🔗

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago