lolka.js 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -131
- package/package.json +25 -26
package/README.md
CHANGED
|
@@ -1,148 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
<br />
|
|
3
|
-
<p>
|
|
4
|
-
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
|
5
|
-
</p>
|
|
6
|
-
<br />
|
|
7
|
-
<p>
|
|
8
|
-
<a href="https://discord.gg/djs"><img src="https://img.shields.io/badge/join_us-on_discord-5865F2?logo=discord&logoColor=white" alt="Discord server" /></a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/v/discord.js.svg?maxAge=3600" alt="npm version" /></a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/discord.js.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
11
|
-
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
|
|
12
|
-
<a href="https://github.com/discordjs/discord.js/commits/main/packages/discord.js"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fdiscord.js" /></a>
|
|
13
|
-
<a href="https://opencollective.com/discordjs"><img src="https://img.shields.io/opencollective/backers/discordjs?maxAge=3600&logo=opencollective" alt="backers" /></a>
|
|
14
|
-
<a href="https://codecov.io/gh/discordjs/discord.js"><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2" alt="Code coverage" /></a>
|
|
15
|
-
</p>
|
|
16
|
-
<p>
|
|
17
|
-
<a href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-vercel.svg" alt="Vercel" /></a>
|
|
18
|
-
<a href="https://www.cloudflare.com"><img src="https://raw.githubusercontent.com/discordjs/discord.js/main/.github/powered-by-workers.png" alt="Cloudflare Workers" height="44" /></a>
|
|
19
|
-
</p>
|
|
20
|
-
</div>
|
|
1
|
+
# lolka.js
|
|
21
2
|
|
|
22
|
-
|
|
3
|
+
**Fork of [discord.js](https://github.com/discordjs/discord.js), licensed under Apache-2.0.**
|
|
4
|
+
Copyright (c) the discord.js contributors.
|
|
23
5
|
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
`lolka.js` is a Node.js module for interacting with the **lolka** bot API. It targets lolka by
|
|
7
|
+
default (REST/Gateway, no manual overrides needed), decodes lolka snowflakes, and resolves lolka
|
|
8
|
+
CDN asset URLs. See [`NOTICE`](https://github.com/Lolka-App/lolka.js/blob/main/NOTICE) /
|
|
9
|
+
[`LICENSE`](https://github.com/Lolka-App/lolka.js/blob/main/LICENSE) for licensing.
|
|
26
10
|
|
|
27
|
-
|
|
28
|
-
- Predictable abstractions
|
|
29
|
-
- Performant
|
|
30
|
-
- 100% coverage of the Discord API
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
**Node.js 22.12.0 or newer is required.**
|
|
11
|
+
## Installing
|
|
35
12
|
|
|
36
13
|
```sh
|
|
37
|
-
npm install
|
|
38
|
-
yarn add discord.js
|
|
39
|
-
pnpm add discord.js
|
|
40
|
-
bun add discord.js
|
|
14
|
+
npm install lolka.js
|
|
41
15
|
```
|
|
42
16
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- [zlib-sync](https://www.npmjs.com/package/zlib-sync) for WebSocket data compression and inflation (`npm install zlib-sync`)
|
|
46
|
-
- [bufferutil](https://www.npmjs.com/package/bufferutil) for a much faster WebSocket connection (`npm install bufferutil`)
|
|
47
|
-
- [@discordjs/voice](https://www.npmjs.com/package/@discordjs/voice) for interacting with the Discord Voice API (`npm install @discordjs/voice`)
|
|
48
|
-
|
|
49
|
-
## Example usage
|
|
50
|
-
|
|
51
|
-
Install discord.js:
|
|
52
|
-
|
|
53
|
-
```sh
|
|
54
|
-
npm install discord.js
|
|
55
|
-
yarn add discord.js
|
|
56
|
-
pnpm add discord.js
|
|
57
|
-
bun add discord.js
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
These examples use [ES modules](https://nodejs.org/api/esm.html#enabling).
|
|
61
|
-
|
|
62
|
-
Register a slash command against the Discord API:
|
|
63
|
-
|
|
64
|
-
```js
|
|
65
|
-
import { REST, Routes } from 'discord.js';
|
|
66
|
-
|
|
67
|
-
const commands = [
|
|
68
|
-
{
|
|
69
|
-
name: 'ping',
|
|
70
|
-
description: 'Replies with Pong!',
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
const rest = new REST({ version: '10' }).setToken(TOKEN);
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
console.log('Started refreshing application (/) commands.');
|
|
78
|
-
|
|
79
|
-
await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands });
|
|
80
|
-
|
|
81
|
-
console.log('Successfully reloaded application (/) commands.');
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.error(error);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
17
|
+
**Node.js 22.12.0 or newer is required.**
|
|
86
18
|
|
|
87
|
-
|
|
19
|
+
## Quick Example
|
|
88
20
|
|
|
89
21
|
```js
|
|
90
|
-
|
|
22
|
+
const { Client, GatewayIntentBits } = require('lolka.js');
|
|
91
23
|
|
|
92
|
-
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
|
24
|
+
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
|
|
93
25
|
|
|
94
|
-
client.
|
|
95
|
-
console.log(`Logged
|
|
26
|
+
client.once('ready', () => {
|
|
27
|
+
console.log(`Logged on as ${client.user.tag}`);
|
|
96
28
|
});
|
|
97
29
|
|
|
98
|
-
client.on(
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
if (interaction.commandName === 'ping') {
|
|
102
|
-
await interaction.reply('Pong!');
|
|
103
|
-
}
|
|
30
|
+
client.on('messageCreate', message => {
|
|
31
|
+
if (message.author.bot) return;
|
|
32
|
+
if (message.content === 'ping') message.channel.send('pong');
|
|
104
33
|
});
|
|
105
34
|
|
|
106
|
-
client.login(
|
|
35
|
+
client.login('token');
|
|
107
36
|
```
|
|
108
|
-
|
|
109
|
-
## Links
|
|
110
|
-
|
|
111
|
-
- [Website][website] ([source][website-source])
|
|
112
|
-
- [Documentation][documentation]
|
|
113
|
-
- [Guide][guide] ([source][guide-source])
|
|
114
|
-
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
|
|
115
|
-
- [discord.js Discord server][discord]
|
|
116
|
-
- [Discord Developers Discord server][discord-developers]
|
|
117
|
-
- [GitHub][source]
|
|
118
|
-
- [npm][npm]
|
|
119
|
-
- [Related libraries][related-libs]
|
|
120
|
-
|
|
121
|
-
### Extensions
|
|
122
|
-
|
|
123
|
-
- [RPC][rpc] ([source][rpc-source])
|
|
124
|
-
|
|
125
|
-
## Contributing
|
|
126
|
-
|
|
127
|
-
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
|
|
128
|
-
[documentation][documentation].
|
|
129
|
-
See [the contribution guide][contributing] if you'd like to submit a PR.
|
|
130
|
-
|
|
131
|
-
## Help
|
|
132
|
-
|
|
133
|
-
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official [discord.js Server][discord].
|
|
134
|
-
|
|
135
|
-
[website]: https://discord.js.org
|
|
136
|
-
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
|
|
137
|
-
[documentation]: https://discord.js.org/docs/packages/discord.js/stable
|
|
138
|
-
[guide]: https://discordjs.guide
|
|
139
|
-
[guide-source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
|
|
140
|
-
[guide-update]: https://discordjs.guide/legacy/additional-info/changes-in-v14
|
|
141
|
-
[discord]: https://discord.gg/djs
|
|
142
|
-
[discord-developers]: https://discord.gg/discord-developers
|
|
143
|
-
[source]: https://github.com/discordjs/discord.js/tree/main/packages/discord.js
|
|
144
|
-
[npm]: https://www.npmjs.com/package/discord.js
|
|
145
|
-
[related-libs]: https://docs.discord.com/developers/developer-tools/community-resources#libraries
|
|
146
|
-
[rpc]: https://www.npmjs.com/package/discord-rpc
|
|
147
|
-
[rpc-source]: https://github.com/discordjs/RPC
|
|
148
|
-
[contributing]: https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md
|
package/package.json
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "lolka.js",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"description": "A powerful library for interacting with the lolka bot API (discord.js-compatible fork)",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "pnpm run docs:test && pnpm run test:typescript",
|
|
8
|
-
"test:typescript": "tsc --noEmit && tsd",
|
|
9
|
-
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty scripts src typings",
|
|
10
|
-
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty scripts src typings",
|
|
11
|
-
"fmt": "pnpm run format",
|
|
12
|
-
"docs": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../ -o ./docs/docs.json && pnpm run docs:new",
|
|
13
|
-
"docs:test": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../",
|
|
14
|
-
"docs:new": "api-extractor run --local --minify && generate-split-documentation",
|
|
15
|
-
"prepack": "node ./scripts/esmDts.mjs",
|
|
16
|
-
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
|
|
17
|
-
"release": "cliff-jumper"
|
|
18
|
-
},
|
|
19
6
|
"main": "./src/index.js",
|
|
20
7
|
"types": "./typings/index.d.ts",
|
|
21
8
|
"exports": {
|
|
@@ -65,24 +52,20 @@
|
|
|
65
52
|
},
|
|
66
53
|
"homepage": "https://github.com/Lolka-App/lolka.js",
|
|
67
54
|
"dependencies": {
|
|
68
|
-
"@discordjs/collection": "workspace:^",
|
|
69
|
-
"@discordjs/formatters": "workspace:^",
|
|
70
|
-
"@discordjs/rest": "workspace:^",
|
|
71
|
-
"@discordjs/util": "workspace:^",
|
|
72
|
-
"@discordjs/ws": "workspace:^",
|
|
73
55
|
"@vladfrangu/async_event_emitter": "^2.4.7",
|
|
74
56
|
"discord-api-types": "^0.38.43",
|
|
75
57
|
"fast-deep-equal": "3.1.3",
|
|
76
58
|
"lodash.snakecase": "4.1.1",
|
|
77
59
|
"magic-bytes.js": "^1.13.0",
|
|
78
60
|
"tslib": "^2.8.1",
|
|
79
|
-
"undici": "7.24.6"
|
|
61
|
+
"undici": "7.24.6",
|
|
62
|
+
"@discordjs/collection": "^2.1.1",
|
|
63
|
+
"@discordjs/formatters": "^0.6.1",
|
|
64
|
+
"@discordjs/rest": "^2.5.0",
|
|
65
|
+
"@discordjs/util": "^1.1.1",
|
|
66
|
+
"@discordjs/ws": "^2.0.2"
|
|
80
67
|
},
|
|
81
68
|
"devDependencies": {
|
|
82
|
-
"@discordjs/api-extractor": "workspace:^",
|
|
83
|
-
"@discordjs/builders": "workspace:^",
|
|
84
|
-
"@discordjs/docgen": "workspace:^",
|
|
85
|
-
"@discordjs/scripts": "workspace:^",
|
|
86
69
|
"@favware/cliff-jumper": "^6.0.0",
|
|
87
70
|
"@types/node": "^22.19.15",
|
|
88
71
|
"cross-env": "^10.1.0",
|
|
@@ -93,12 +76,28 @@
|
|
|
93
76
|
"prettier": "^3.8.1",
|
|
94
77
|
"tsd": "^0.33.0",
|
|
95
78
|
"turbo": "^2.8.21",
|
|
96
|
-
"typescript": "~5.9.3"
|
|
79
|
+
"typescript": "~5.9.3",
|
|
80
|
+
"@discordjs/api-extractor": "^7.52.7",
|
|
81
|
+
"@discordjs/builders": "^1.11.1",
|
|
82
|
+
"@discordjs/docgen": "^0.12.1",
|
|
83
|
+
"@discordjs/scripts": "^0.1.0"
|
|
97
84
|
},
|
|
98
85
|
"engines": {
|
|
99
86
|
"node": ">=22.12.0"
|
|
100
87
|
},
|
|
101
88
|
"publishConfig": {
|
|
102
89
|
"provenance": true
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"test": "pnpm run docs:test && pnpm run test:typescript",
|
|
93
|
+
"test:typescript": "tsc --noEmit && tsd",
|
|
94
|
+
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty scripts src typings",
|
|
95
|
+
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty scripts src typings",
|
|
96
|
+
"fmt": "pnpm run format",
|
|
97
|
+
"docs": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../ -o ./docs/docs.json && pnpm run docs:new",
|
|
98
|
+
"docs:test": "docgen -i \"./src/*.js\" \"./src/**/*.js\" -c ./docs/index.json -r ../../",
|
|
99
|
+
"docs:new": "api-extractor run --local --minify && generate-split-documentation",
|
|
100
|
+
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
|
|
101
|
+
"release": "cliff-jumper"
|
|
103
102
|
}
|
|
104
|
-
}
|
|
103
|
+
}
|