rmtrollbot 1.1.0 → 1.1.2
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 +2 -0
- package/index.mts +5 -2
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -33,5 +33,7 @@ It also has anti-colorcrash
|
|
|
33
33
|
```ts
|
|
34
34
|
bot.changeColor("#272822") // NICE TRY!!
|
|
35
35
|
```
|
|
36
|
+
# Extensions
|
|
37
|
+
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot
|
|
36
38
|
# Bots using this package
|
|
37
39
|
None have been recorded, but please use this package
|
package/index.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { io } from "socket.io-client";
|
|
2
|
+
// import { Decoder } from "rmtrollbot-decode"
|
|
2
3
|
|
|
3
4
|
export type message = {
|
|
4
5
|
nick: string; // This is not shown in the RMTrollbox Manual, but does exist
|
|
@@ -49,16 +50,18 @@ export type userupdate = {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export class TrollBot {
|
|
53
|
+
// protected ext: Decoder | undefined; // DEPRECATED
|
|
52
54
|
protected name: string;
|
|
53
55
|
protected readonly ogname: string;
|
|
54
56
|
protected color: string;
|
|
55
57
|
protected readonly ogcolor: string;
|
|
56
58
|
protected socket = io("https://trollbox.fun");
|
|
57
|
-
constructor(name: string, color: string) {
|
|
59
|
+
constructor(name: string, color: string, /*extension?: Decoder*/) {
|
|
58
60
|
this.name = name
|
|
59
61
|
this.ogname = name
|
|
60
62
|
this.color = color
|
|
61
63
|
this.ogcolor = color
|
|
64
|
+
/// this.ext = extension
|
|
62
65
|
this.socket.emit("user joined", name, color, "bot", "")
|
|
63
66
|
}
|
|
64
67
|
send(...args: string[]) {
|
|
@@ -73,7 +76,7 @@ export class TrollBot {
|
|
|
73
76
|
onNickChange(callback: (olduser: userchangenick, newuser: userchangenick) => void) {
|
|
74
77
|
this.socket.on("user change nick", callback)
|
|
75
78
|
}
|
|
76
|
-
onUserUpdate(callback: (data:
|
|
79
|
+
onUserUpdate(callback: (data: {[P: string]: userupdate}) => void) {
|
|
77
80
|
this.socket.on("update users", callback)
|
|
78
81
|
}
|
|
79
82
|
emit<Ev extends string>(ev: Ev, ...args: any[]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rmtrollbot",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A package making the producing of rmtrollbox bots easier.",
|
|
5
5
|
"main": "index.mts",
|
|
6
6
|
"scripts": {
|
|
@@ -18,5 +18,8 @@
|
|
|
18
18
|
"type": "commonjs",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"socket.io-client": "^4.8.3"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/he": "^1.2.3"
|
|
21
24
|
}
|
|
22
25
|
}
|