erlc-api 1.3.4 → 1.3.6
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 +21 -3
- package/package.json +1 -1
- package/src/types/index.d.ts +68 -61
package/README.md
CHANGED
|
@@ -25,20 +25,38 @@ client.config(); // Registers your client
|
|
|
25
25
|
Now you can start using API Methods - here are a few examples:
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
const erlc = require("erlc");
|
|
28
|
+
// GetServerInfo.js
|
|
29
|
+
const erlc = require("erlc-api");
|
|
31
30
|
|
|
32
31
|
const getServerFunc = async () => {
|
|
33
32
|
const serverId = ""; // The server ApiKey you wish to target. You can get this api key in your (Server Settings)
|
|
34
33
|
const server = await erlc.getServer(serverId).catch(console.log); // Gets the server, logs any errors
|
|
35
34
|
|
|
36
35
|
console.log(server); // Logs the server object
|
|
36
|
+
|
|
37
|
+
// Expected Response:
|
|
38
|
+
// {
|
|
39
|
+
// Name: "Your Sever Name",
|
|
40
|
+
// CurrentPlayers: 0,
|
|
41
|
+
// MaxPlayers: 40,
|
|
42
|
+
// JoinKey: "Your Code Join",
|
|
43
|
+
// AccVerifiedReq: "Disabled" | "Email" | "Phone/ID",
|
|
44
|
+
// TeamBalance: true or false ,
|
|
45
|
+
// OwnerUsername: "Your Name",
|
|
46
|
+
// CoOwnerUsernames: [],
|
|
47
|
+
// VanityURL: "https://policeroleplay.community/join?code=YourCode",
|
|
48
|
+
// },
|
|
37
49
|
};
|
|
38
50
|
|
|
39
51
|
getServerFunc();
|
|
40
52
|
```
|
|
41
53
|
|
|
54
|
+
### [Discord Bot](https://discord.com/oauth2/authorize?client_id=1014990793280323624)
|
|
55
|
+
|
|
56
|
+
The Discord Bot Back Online 29/05/2024
|
|
57
|
+
|
|
58
|
+
## [Module Examples](https://scarlet-2.gitbook.io/erlc-api/)
|
|
59
|
+
|
|
42
60
|
### [PRC API Docs](https://apidocs.policeroleplay.community/reference/api-reference)
|
|
43
61
|
|
|
44
62
|
### Credits
|
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -1,74 +1,81 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
declare module "erlc-api" {
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
globalToken: string; // The ER:LC global API token
|
|
4
|
+
}
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export const BASEURL = "https://api.policeroleplay.community/v1";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type PlayerId = string;
|
|
9
|
+
type PlayerName = string;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export type ErlcPlayer = `${PlayerName}:${PlayerId}`; // Playername:UserID
|
|
12
|
+
export type ErlcPlayerPermission =
|
|
13
|
+
| "Normal"
|
|
14
|
+
| "Server Administrator"
|
|
15
|
+
| "Server Owner"
|
|
16
|
+
| "Server Moderator";
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export interface ServerStatus {
|
|
19
|
+
Name: string; // The server name
|
|
20
|
+
OwnerId: number; // The roblox id of the server owner
|
|
21
|
+
CoOwnerIds: number[]; // The roblox ids of the server co owners
|
|
22
|
+
CurrentPlayers: number; // The amount of people currently in-game
|
|
23
|
+
MaxPlayers: number; // The amount of people who can join the server including server owner
|
|
24
|
+
JoinKey: string; // The code used to join the private server
|
|
25
|
+
AccVerifiedReq: "Disabled" | "Email" | "Phone/ID"; // The level of verification roblox accounts need to join the private server
|
|
26
|
+
TeamBalance: boolean; // If team balance is enabled or not
|
|
27
|
+
}
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
export interface ServerPlayer {
|
|
30
|
+
Player: ErlcPlayer;
|
|
31
|
+
Permission: ErlcPlayerPermission;
|
|
32
|
+
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
export interface JoinLog {
|
|
35
|
+
Join: boolean; // True is join and False is leave
|
|
36
|
+
Timestamp: number; // Timestamp in seconds
|
|
37
|
+
Player: ErlcPlayer;
|
|
38
|
+
}
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
export interface KillLog {
|
|
41
|
+
Killed: ErlcPlayer;
|
|
42
|
+
Timestamp: number; // Timestamp in seconds
|
|
43
|
+
Killer: ErlcPlayer;
|
|
44
|
+
}
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
export interface CommandLog {
|
|
47
|
+
Player: ErlcPlayer;
|
|
48
|
+
Timestamp: number; // Timestamp in seconds
|
|
49
|
+
Command: string;
|
|
50
|
+
}
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
export interface ModcallLog {
|
|
53
|
+
Caller: ErlcPlayer;
|
|
54
|
+
Moderator?: ErlcPlayer; // If call is unanswered property is undefined
|
|
55
|
+
Timestamp: number; // Timestamp in seconds
|
|
56
|
+
}
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
export type ServerBan = Record<PlayerId, PlayerName>;
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
export interface VSMCommandBody {
|
|
61
|
+
command: string; // ":h Hey everyone!"
|
|
62
|
+
}
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
export function getBans(serverToken: string): Promise<ServerBan>;
|
|
65
|
+
export function getCommandLogs(serverToken: string): Promise<CommandLog[]>;
|
|
66
|
+
export function getJoinLogs(serverToken: string): Promise<JoinLog[]>;
|
|
67
|
+
export function getKillLogs(serverToken: string): Promise<KillLog[]>;
|
|
68
|
+
export function getModcallLogs(serverToken: string): Promise<ModcallLog[]>;
|
|
69
|
+
export function getPlayers(serverToken: string): Promise<ServerPlayer[]>;
|
|
70
|
+
export function getQueue(serverToken: string): Promise<number[]>;
|
|
71
|
+
export function getServer(serverToken: string): Promise<ServerStatus>;
|
|
72
|
+
export function runCommand(
|
|
73
|
+
serverToken: string,
|
|
74
|
+
command: string
|
|
75
|
+
): Promise<boolean>;
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
77
|
+
export class Client {
|
|
78
|
+
constructor(options: ClientConfig);
|
|
79
|
+
config(): ClientConfig;
|
|
80
|
+
}
|
|
81
|
+
}
|