rmtrollbot 2.0.1 → 2.1.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 +14 -2
- package/index.mts +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Reversed Meow TrollBot
|
|
2
|
-
[](https://packagequality.com/#?package=rmtrollbot)
|
|
2
|
+
[](https://packagequality.com/#?package=rmtrollbot)
|
|
3
|
+
<br>
|
|
3
4
|
A package making the producing of rmtrollbox bots easier.<br>
|
|
4
|
-
To start a bot, you must start a new TrollBot element
|
|
5
|
+
To start a bot, you must start a new TrollBot element.
|
|
6
|
+
|
|
5
7
|
```ts
|
|
6
8
|
let bot = new TrollBot("clanker", "gray")
|
|
7
9
|
```
|
|
@@ -36,6 +38,16 @@ bot.changeColor("#272822") // NICE TRY!!
|
|
|
36
38
|
```
|
|
37
39
|
## New for v2.0.0!
|
|
38
40
|
All types are now moved to [rmtrollbot-types](https://www.npmjs.com/package/rmtrollbot-types).
|
|
41
|
+
## New for v2.1.0!
|
|
42
|
+
Tags are now supported!
|
|
43
|
+
```ts
|
|
44
|
+
let bot = new TrollBot("clankah", "#BFBFBF", "bot" /* Defaults to "bot" */)
|
|
45
|
+
```
|
|
46
|
+
Same as for v1.1.0, you can also change the tag!
|
|
47
|
+
```ts
|
|
48
|
+
bot.changeTag("") // Changes tag from "bot" to ""
|
|
49
|
+
bot.changeBack() // Changes tag back to "bot"
|
|
50
|
+
```
|
|
39
51
|
# Extensions
|
|
40
52
|
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot<br>
|
|
41
53
|
[rmtrollbot-ping](https://www.npmjs.com/package/rmtrollbot-ping): Ping example
|
package/index.mts
CHANGED
|
@@ -8,14 +8,21 @@ export class TrollBot {
|
|
|
8
8
|
protected readonly ogname: string;
|
|
9
9
|
protected color: string;
|
|
10
10
|
protected readonly ogcolor: string;
|
|
11
|
+
protected tag: string;
|
|
12
|
+
protected readonly ogtag: string;
|
|
11
13
|
protected socket = io("https://trollbox.fun");
|
|
12
|
-
constructor(name: string, color: string,
|
|
14
|
+
constructor(name: string, color: string, tag: string = "bot") {
|
|
13
15
|
this.name = name
|
|
14
16
|
this.ogname = name
|
|
15
17
|
this.color = color
|
|
16
18
|
this.ogcolor = color
|
|
19
|
+
this.tag = tag
|
|
20
|
+
this.ogtag = tag
|
|
17
21
|
/// this.ext = extension
|
|
18
|
-
this.socket.emit("user joined", name, color,
|
|
22
|
+
this.socket.emit("user joined", name, color, tag, "")
|
|
23
|
+
}
|
|
24
|
+
protected rejoin(){
|
|
25
|
+
this.socket.emit("user joined", this.name, this.color, this.tag, "")
|
|
19
26
|
}
|
|
20
27
|
send(...args: string[]) {
|
|
21
28
|
this.socket.send(...args)
|
|
@@ -40,18 +47,22 @@ export class TrollBot {
|
|
|
40
47
|
}
|
|
41
48
|
changeNick(newn: string) {
|
|
42
49
|
this.name = newn
|
|
43
|
-
this.
|
|
50
|
+
this.rejoin()
|
|
44
51
|
}
|
|
45
52
|
changeColor(newc: string) {
|
|
46
53
|
if (!newc.includes("272822")) {
|
|
47
54
|
this.color = newc
|
|
48
|
-
this.
|
|
55
|
+
this.rejoin()
|
|
49
56
|
} else {
|
|
50
57
|
this.socket.send("NICE TRY!!")
|
|
51
58
|
}
|
|
52
59
|
}
|
|
60
|
+
changeTag(newt: string){
|
|
61
|
+
this.tag = newt
|
|
62
|
+
this.rejoin()
|
|
63
|
+
}
|
|
53
64
|
changeBack() {
|
|
54
|
-
[this.name, this.color] = [this.ogcolor, this.ogname]
|
|
55
|
-
this.
|
|
65
|
+
[this.name, this.color, this.tag] = [this.ogcolor, this.ogname, this.ogtag]
|
|
66
|
+
this.rejoin()
|
|
56
67
|
}
|
|
57
68
|
}
|