rmtrollbot 3.0.2 → 3.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 +9 -5
- package/index.mts +17 -8
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Reversed Meow TrollBot
|
|
2
|
-
[](https://packagequality.com/#?package=rmtrollbot)](https://packagequality.com/#?package=rmtrollbot)
|
|
3
3
|
# About
|
|
4
4
|
A package making the producing of rmtrollbox bots easier.<br>
|
|
5
5
|
To start a bot, you must start a new TrollBot element.
|
|
@@ -36,7 +36,7 @@ It also has anti-colorcrash
|
|
|
36
36
|
bot.changeColor("#272822") // NICE TRY!!
|
|
37
37
|
```
|
|
38
38
|
## New for v2.0.0!
|
|
39
|
-
All types are now moved to [rmtrollbot-types](https://www.npmjs.com/package/rmtrollbot-types).
|
|
39
|
+
All types are now moved to [`rmtrollbot-types`](https://www.npmjs.com/package/rmtrollbot-types).
|
|
40
40
|
## New for v2.1.0!
|
|
41
41
|
Tags are now supported!
|
|
42
42
|
```ts
|
|
@@ -48,7 +48,7 @@ bot.changeTag("") // Changes tag from "bot" to ""
|
|
|
48
48
|
bot.changeBack() // Changes tag back to "bot"
|
|
49
49
|
```
|
|
50
50
|
## New for v3.0.0!
|
|
51
|
-
This package now uses [
|
|
51
|
+
This package now uses [`@rmtrollbot/loader`](https://www.npmjs.com/package/@rmtrollbot/loader) instead of [`socket.io-client`](https://www.npmjs.com/package/socket.io-client)<br>
|
|
52
52
|
Also there is now support for editing, deleting, and IDs!
|
|
53
53
|
```ts
|
|
54
54
|
/* Deleting last message */
|
|
@@ -74,9 +74,13 @@ bot.lastMessageID((id)=>{
|
|
|
74
74
|
bot.editByID(id, "awh... you missed it!")
|
|
75
75
|
})
|
|
76
76
|
```
|
|
77
|
+
## New for v3.1.0!
|
|
78
|
+
Dang, these updates are comming FAST!<br>
|
|
79
|
+
Now, rmtrollbot uses [`ora`](https://www.npmjs.com/package/ora) when initializing a bot!<br>
|
|
80
|
+
Send any issues/suggestions for this package [here](https://github.com/Agsgt2/rmtrollbot-issues)!
|
|
77
81
|
# Extensions
|
|
78
|
-
[rmtrollbot-decode](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot<br>
|
|
79
|
-
[rmtrollbot-ping](https://www.npmjs.com/package/rmtrollbot-ping): Ping example
|
|
82
|
+
[`rmtrollbot-decode`](https://www.npmjs.com/package/rmtrollbot-decode?activeTab=readme): Decoder for rmtrollbot<br>
|
|
83
|
+
[`rmtrollbot-ping`](https://www.npmjs.com/package/rmtrollbot-ping): Ping example
|
|
80
84
|
# Other Package Managers
|
|
81
85
|
These are the other package managers that are also supported.
|
|
82
86
|
## [PNPM](https://www.npmjs.com/package/pnpm)
|
package/index.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { init } from "@rmtrollbot/loader";
|
|
2
|
-
|
|
2
|
+
import ora from "ora"
|
|
3
3
|
import { message, user, userchangenick, userupdate, rmtbID } from "rmtrollbot-types"
|
|
4
4
|
|
|
5
5
|
export class TrollBot {
|
|
6
|
-
// protected ext: Decoder | undefined; // DEPRECATED
|
|
7
6
|
protected name: string;
|
|
8
7
|
protected readonly ogname: string;
|
|
9
8
|
protected color: string;
|
|
@@ -18,8 +17,18 @@ export class TrollBot {
|
|
|
18
17
|
this.ogcolor = color
|
|
19
18
|
this.tag = tag
|
|
20
19
|
this.ogtag = tag
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const spinner = ora({
|
|
21
|
+
text: "Connecting...",
|
|
22
|
+
spinner: {
|
|
23
|
+
frames: "rmtrollbot".split("")
|
|
24
|
+
},
|
|
25
|
+
color: "cyan"
|
|
26
|
+
})
|
|
27
|
+
this.socket.on("_connected", () => {
|
|
28
|
+
spinner.text = "Joining..."
|
|
29
|
+
this.socket.emit("user joined", name, color, tag, "")
|
|
30
|
+
spinner.stop()
|
|
31
|
+
})
|
|
23
32
|
}
|
|
24
33
|
protected rejoin() {
|
|
25
34
|
this.socket.emit("user joined", this.name, this.color, this.tag, "")
|
|
@@ -36,7 +45,7 @@ export class TrollBot {
|
|
|
36
45
|
onNickChange(callback: (olduser: userchangenick, newuser: userchangenick) => void) {
|
|
37
46
|
this.socket.on("user change nick", callback)
|
|
38
47
|
}
|
|
39
|
-
onUserUpdate(callback: (data: { [P: string]: userupdate }) => void) {
|
|
48
|
+
onUserUpdate(callback: (data: { [ P: string ]: userupdate }) => void) {
|
|
40
49
|
this.socket.on("update users", callback)
|
|
41
50
|
}
|
|
42
51
|
emit<Ev extends string>(ev: Ev, ...args: any[]) {
|
|
@@ -62,7 +71,7 @@ export class TrollBot {
|
|
|
62
71
|
this.rejoin()
|
|
63
72
|
}
|
|
64
73
|
changeBack() {
|
|
65
|
-
[this.name, this.color, this.tag] = [this.ogcolor, this.ogname, this.ogtag]
|
|
74
|
+
[ this.name, this.color, this.tag ] = [ this.ogcolor, this.ogname, this.ogtag ]
|
|
66
75
|
this.rejoin()
|
|
67
76
|
}
|
|
68
77
|
lastMessageID(callback: (id: rmtbID) => void) {
|
|
@@ -80,10 +89,10 @@ export class TrollBot {
|
|
|
80
89
|
onEdit(callback: (id: rmtbID, text: string) => void) {
|
|
81
90
|
this.socket.on("edited", callback)
|
|
82
91
|
}
|
|
83
|
-
editLastMessage(newt: string){
|
|
92
|
+
editLastMessage(newt: string) {
|
|
84
93
|
this.socket.emit("edit", newt)
|
|
85
94
|
}
|
|
86
|
-
editByID(id: rmtbID, newt: string){
|
|
95
|
+
editByID(id: rmtbID, newt: string) {
|
|
87
96
|
this.socket.emit("edit_ownid", id, newt)
|
|
88
97
|
}
|
|
89
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rmtrollbot",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A package making the producing of rmtrollbox bots easier.",
|
|
5
5
|
"main": "index.mts",
|
|
6
6
|
"scripts": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"type": "commonjs",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@rmtrollbot/loader": "^1.0.0",
|
|
21
|
+
"ora": "^9.3.0",
|
|
21
22
|
"rmtrollbot-types": "^1.0.0"
|
|
22
23
|
}
|
|
23
24
|
}
|