Skip to content

@akarui/aoi.music

Terminal window
npm install @akarui/aoi.music ffmpeg-static

To use aoi.music, you are required to edit your index.js file.

1
const { AoiClient } = require("aoi.js");
2
const { AoiVoice, PlayerEvents, PluginName, Cacher, Filter } = require("@akarui/aoi.music");
3
4
const 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("@akarui/aoi.db"),
12
dbType: "KeyValue",
13
tables: ["main"],
14
securityKey: "a-32-characters-long-string-here",
15
},
16
});
17
18
const 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)
29
client.command({
30
name: "ping",
31
code: `Pong! $pingms`,
32
});
33
34
// optional (cacher / filter)
35
voice.addPlugin(PluginName.Cacher, new Cacher("memory" /* or "disk" */));
36
voice.addPlugin(PluginName.Filter, new Filter({
37
filterFromStart: false
38
})),
39
40
voice.bindExecutor(client.functionManager.interpreter);

Typings can be found here

1
const 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
});