rmtrollbot 1.1.1 → 2.0.0
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 +4 -1
- package/index.mts +6 -50
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -33,7 +33,10 @@ It also has anti-colorcrash
|
|
|
33
33
|
```ts
|
|
34
34
|
bot.changeColor("#272822") // NICE TRY!!
|
|
35
35
|
```
|
|
36
|
+
## New for v2.0.0!
|
|
37
|
+
All types are now moved to [rmtrollbot-types](https://www.npmjs.com/package/rmtrollbot-types).
|
|
36
38
|
# Extensions
|
|
37
|
-
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot
|
|
39
|
+
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot<br>
|
|
40
|
+
[rmtrollbot-ping](https://www.npmjs.com/package/rmtrollbot-ping): Ping example
|
|
38
41
|
# Bots using this package
|
|
39
42
|
None have been recorded, but please use this package
|
package/index.mts
CHANGED
|
@@ -1,64 +1,20 @@
|
|
|
1
1
|
import { io } from "socket.io-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
nick: string; // This is not shown in the RMTrollbox Manual, but does exist
|
|
5
|
-
sid: string;
|
|
6
|
-
bot: boolean;
|
|
7
|
-
// style is unused
|
|
8
|
-
date: number;
|
|
9
|
-
color: string;
|
|
10
|
-
home: string;
|
|
11
|
-
msg: string;
|
|
12
|
-
id: string;
|
|
13
|
-
channel: string;
|
|
14
|
-
system: boolean;
|
|
15
|
-
own: boolean;
|
|
16
|
-
reply: boolean;
|
|
17
|
-
for?: string;
|
|
18
|
-
files?: {
|
|
19
|
-
url: string;
|
|
20
|
-
mime: string;
|
|
21
|
-
name: string;
|
|
22
|
-
spoiler: boolean;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type user = {
|
|
27
|
-
sid: string;
|
|
28
|
-
nick: string;
|
|
29
|
-
color: string;
|
|
30
|
-
home: string;
|
|
31
|
-
bot: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type userchangenick = {
|
|
35
|
-
nick: string;
|
|
36
|
-
color: string;
|
|
37
|
-
home: string;
|
|
38
|
-
date: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type userupdate = {
|
|
42
|
-
nick: string;
|
|
43
|
-
home: string;
|
|
44
|
-
color: string;
|
|
45
|
-
status: "online" | "dnd" | "afk";
|
|
46
|
-
customst: string | false;
|
|
47
|
-
// style is unused
|
|
48
|
-
bot: boolean;
|
|
49
|
-
}
|
|
2
|
+
// import { Decoder } from "rmtrollbot-decode"
|
|
3
|
+
import { message, user, userchangenick, userupdate } from "rmtrollbot-types"
|
|
50
4
|
|
|
51
5
|
export class TrollBot {
|
|
6
|
+
// protected ext: Decoder | undefined; // DEPRECATED
|
|
52
7
|
protected name: string;
|
|
53
8
|
protected readonly ogname: string;
|
|
54
9
|
protected color: string;
|
|
55
10
|
protected readonly ogcolor: string;
|
|
56
11
|
protected socket = io("https://trollbox.fun");
|
|
57
|
-
constructor(name: string, color: string) {
|
|
12
|
+
constructor(name: string, color: string, /*extension?: Decoder*/) {
|
|
58
13
|
this.name = name
|
|
59
14
|
this.ogname = name
|
|
60
15
|
this.color = color
|
|
61
16
|
this.ogcolor = color
|
|
17
|
+
/// this.ext = extension
|
|
62
18
|
this.socket.emit("user joined", name, color, "bot", "")
|
|
63
19
|
}
|
|
64
20
|
send(...args: string[]) {
|
|
@@ -73,7 +29,7 @@ export class TrollBot {
|
|
|
73
29
|
onNickChange(callback: (olduser: userchangenick, newuser: userchangenick) => void) {
|
|
74
30
|
this.socket.on("user change nick", callback)
|
|
75
31
|
}
|
|
76
|
-
onUserUpdate(callback: (data:
|
|
32
|
+
onUserUpdate(callback: (data: {[P: string]: userupdate}) => void) {
|
|
77
33
|
this.socket.on("update users", callback)
|
|
78
34
|
}
|
|
79
35
|
emit<Ev extends string>(ev: Ev, ...args: any[]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rmtrollbot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A package making the producing of rmtrollbox bots easier.",
|
|
5
5
|
"main": "index.mts",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"type": "commonjs",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"rmtrollbot-types": "^1.0.0",
|
|
20
21
|
"socket.io-client": "^4.8.3"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/he": "^1.2.3"
|
|
21
25
|
}
|
|
22
26
|
}
|