npm i @aoijs/aoi.music
yarn add @aoijs/aoi.music
pnpm add @aoijs/aoi.music
To use aoi.music, you are required to edit your index.js file.
1const { AoiClient } = require("aoi.js");2const { AoiVoice, PlayerEvents, PluginName, Cacher, Filter } = require("@aoijs/aoi.music");3 4const client = new AoiClient({5 token: "Discord Bot Token",6 prefix: "Discord Bot Prefix",7 intents: ["MessageContent", "Guilds", "GuildMessages", "GuildVoiceStates"],8 events: ["onMessage", "onInteractionCreate"],9 database: {10 type: "aoi.db",11 db: require("@aoijs/aoi.db"),12 dbType: "KeyValue",13 tables: ["main"],14 securityKey: "a-32-characters-long-string-here",15 },16});17 18const voice = new AoiVoice(client, {19 requestOptions: {20 offsetTimeout: 0,21 soundcloudLikeTrackLimit: 200,22 },23 searchOptions: {24 youtubeClient: "WEB"25 }26});27 28// Command Example (ping)29client.command({30 name: "ping",31 code: `Pong! $pingms`,32});33 34// optional (cacher / filter)35voice.addPlugin(PluginName.Cacher, new Cacher("memory" /* or "disk" */));36voice.addPlugin(PluginName.Filter, new Filter({37 filterFromStart: false38})),39 40voice.bindExecutor(client.functionManager.interpreter);
Typings can be found here
1const voice = new AoiVoice(<client instance>, {2 searchOptions?: {3 soundcloudClientId?: string;4 youtubeAuth?: PathLike;5 youtubeClient?: "WEB" | "ANDROID" | "YTMUSIC";6 youtubeCookie?: string;7 youtubegl?: string;8 spotifyAuth?: {9 clientId: string;10 clientSecret: string;11 }12 },13 devOptions?: {14 debug: boolean;15 },16 requestOptions?: {17 offsetTimeout?: number;18 soundcloudLikeTrackLimit?: number;19 spotifyPlaylistLimit?: number;20 youtubePlaylistLimit?: number;21 }22});