erlc-api 2.0.0 → 2.2.1
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 +15 -7
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -20,11 +20,12 @@ npm install erlc-api
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
### TypeScript/ES Modules
|
|
23
|
+
|
|
23
24
|
```typescript
|
|
24
25
|
import { Client } from 'erlc-api';
|
|
25
26
|
|
|
26
27
|
const client = new Client({
|
|
27
|
-
globalToken: 'your-global-token'
|
|
28
|
+
globalToken: 'your-global-token',
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
// Get server information
|
|
@@ -34,14 +35,19 @@ console.log(serverInfo);
|
|
|
34
35
|
// Get players
|
|
35
36
|
const players = await client.getPlayers('server-token');
|
|
36
37
|
console.log(players);
|
|
38
|
+
|
|
39
|
+
//Run Command
|
|
40
|
+
const Command = await client.runCommand('server-token', ':h Hello');
|
|
41
|
+
console.log(Command);
|
|
37
42
|
```
|
|
38
43
|
|
|
39
44
|
### CommonJS
|
|
45
|
+
|
|
40
46
|
```javascript
|
|
41
47
|
const { Client } = require('erlc-api');
|
|
42
48
|
|
|
43
49
|
const client = new Client({
|
|
44
|
-
globalToken: 'your-global-token'
|
|
50
|
+
globalToken: 'your-global-token',
|
|
45
51
|
});
|
|
46
52
|
|
|
47
53
|
// Using async/await
|
|
@@ -56,16 +62,18 @@ async function getServerInfo() {
|
|
|
56
62
|
```
|
|
57
63
|
|
|
58
64
|
### Browser
|
|
65
|
+
|
|
59
66
|
```html
|
|
60
67
|
<script src="node_modules/erlc-api/dist/browser/erlc.min.js"></script>
|
|
61
68
|
<script>
|
|
62
69
|
const client = new ERLC.Client({
|
|
63
|
-
globalToken: 'your-global-token'
|
|
70
|
+
globalToken: 'your-global-token',
|
|
64
71
|
});
|
|
65
72
|
|
|
66
|
-
client
|
|
67
|
-
.
|
|
68
|
-
.
|
|
73
|
+
client
|
|
74
|
+
.getServer('server-token')
|
|
75
|
+
.then((server) => console.log(server))
|
|
76
|
+
.catch((error) => console.error(error));
|
|
69
77
|
</script>
|
|
70
78
|
```
|
|
71
79
|
|
|
@@ -123,4 +131,4 @@ npm run format
|
|
|
123
131
|
|
|
124
132
|
## License
|
|
125
133
|
|
|
126
|
-
MIT License - see LICENSE file for details.
|
|
134
|
+
MIT License - see LICENSE file for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erlc-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A modern API wrapper for ER:LC with TypeScript and browser support",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "npm run clean && npm run build:all",
|
|
14
14
|
"build:all": "npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:types",
|
|
15
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
16
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
17
|
-
"build:browser": "webpack --config webpack.config.js",
|
|
18
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
19
15
|
"clean": "rimraf dist",
|
|
20
16
|
"test": "jest",
|
|
21
17
|
"lint": "eslint src --ext .ts",
|
|
22
18
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
23
|
-
"prepare": "npm run build",
|
|
24
19
|
"docs": "typedoc"
|
|
25
20
|
},
|
|
26
21
|
"keywords": [
|