rmtrollbot 2.0.2 → 2.1.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 +34 -2
- package/index.mts +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Reversed Meow TrollBot
|
|
2
2
|
[](https://packagequality.com/#?package=rmtrollbot)
|
|
3
|
-
|
|
4
3
|
<br>
|
|
5
4
|
A package making the producing of rmtrollbox bots easier.<br>
|
|
6
|
-
To start a bot, you must start a new TrollBot element
|
|
5
|
+
To start a bot, you must start a new TrollBot element.
|
|
7
6
|
|
|
8
7
|
```ts
|
|
9
8
|
let bot = new TrollBot("clanker", "gray")
|
|
@@ -39,8 +38,41 @@ bot.changeColor("#272822") // NICE TRY!!
|
|
|
39
38
|
```
|
|
40
39
|
## New for v2.0.0!
|
|
41
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
|
+
```
|
|
42
51
|
# Extensions
|
|
43
52
|
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot<br>
|
|
44
53
|
[rmtrollbot-ping](https://www.npmjs.com/package/rmtrollbot-ping): Ping example
|
|
54
|
+
# Other Package Managers
|
|
55
|
+
These are the other package managers that are also supported.
|
|
56
|
+
## [PNPM]()
|
|
57
|
+
To install this package by PNPM, run the following:
|
|
58
|
+
```sh
|
|
59
|
+
pnpm i rmtrollbot
|
|
60
|
+
```
|
|
61
|
+
## [YARN]()
|
|
62
|
+
To install this package by Yarn, run the following:
|
|
63
|
+
```sh
|
|
64
|
+
yarn add rmtrollbot
|
|
65
|
+
```
|
|
66
|
+
Check out the same package in the Yarn website [here](https://yarnpkg.com/package?name=rmtrollbot)!
|
|
67
|
+
## [DENO]()
|
|
68
|
+
To install this package by Deno, run the following:
|
|
69
|
+
```sh
|
|
70
|
+
deno install npm:rmtrollbot
|
|
71
|
+
```
|
|
72
|
+
## [BUN]()
|
|
73
|
+
To install this package by Bun, run the following:
|
|
74
|
+
```sh
|
|
75
|
+
bun add rmtrollbot
|
|
76
|
+
```
|
|
45
77
|
# Bots using this package
|
|
46
78
|
None have been recorded, but please use this package
|
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
|
}
|