rmtrollbot 1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -0
  3. package/index.mts +84 -0
  4. package/package.json +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agzgt2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # Reversed Meow TrollBot
2
+ A package making the producing of rmtrollbox bots easier.<br>
3
+ To start a bot, you must start a new TrollBot element
4
+ ```ts
5
+ let bot = new Bot("clanker", "gray")
6
+ ```
package/index.mts ADDED
@@ -0,0 +1,84 @@
1
+ import { io } from "socket.io-client";
2
+
3
+ export type message = {
4
+ sid: string;
5
+ bot: boolean;
6
+ // style is unused
7
+ date: number;
8
+ color: string;
9
+ home: string;
10
+ msg: string;
11
+ id: string;
12
+ channel: string;
13
+ system: boolean;
14
+ own: boolean;
15
+ reply: boolean;
16
+ for?: string;
17
+ files?: {
18
+ url: string;
19
+ mime: string;
20
+ name: string;
21
+ spoiler: boolean;
22
+ };
23
+ }
24
+
25
+ export type user = {
26
+ sid: string;
27
+ nick: string;
28
+ color: string;
29
+ home: string;
30
+ bot: boolean;
31
+ }
32
+
33
+ export type userchangenick = {
34
+ nick: string;
35
+ color: string;
36
+ home: string;
37
+ date: number;
38
+ }
39
+
40
+ export type userupdate = {
41
+ nick: string;
42
+ home: string;
43
+ color: string;
44
+ status: "online" | "dnd" | "afk";
45
+ customst: string | false;
46
+ // style is unused
47
+ bot: boolean;
48
+ }
49
+
50
+ export class TrollBot {
51
+ protected name: string;
52
+ protected readonly ogname: string;
53
+ protected color: string;
54
+ protected readonly ogcolor: string;
55
+ protected socket = io("https://trollbox.fun");
56
+ constructor(name: string, color: string) {
57
+ this.name = name
58
+ this.ogname = name
59
+ this.color = color
60
+ this.ogcolor = color
61
+ this.socket.emit("user joined", name, color, "bot", "")
62
+ }
63
+ send(...args: string[]) {
64
+ this.socket.send(...args)
65
+ }
66
+ onMessage(callback: (data: message) => void) {
67
+ this.socket.on("message", callback)
68
+ }
69
+ onUser(event: "join" | "leave", callback: (data: user) => void) {
70
+ this.socket.on((event == "join" ? "user joined" : "user left"), callback)
71
+ }
72
+ onNickChange(callback: (olduser: userchangenick, newuser: userchangenick) => void) {
73
+ this.socket.on("user change nick", callback)
74
+ }
75
+ onUserUpdate(callback: (data: userupdate[]) => void) {
76
+ this.socket.on("update users", callback)
77
+ }
78
+ emit<Ev extends string>(ev: Ev, ...args: any[]) {
79
+ this.socket.emit(ev, ...args)
80
+ }
81
+ disconnect() {
82
+ this.socket.disconnect()
83
+ }
84
+ }
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "rmtrollbot",
3
+ "version": "1.0.0",
4
+ "description": "A package making the producing of rmtrollbox bots easier.",
5
+ "main": "index.mts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "MIT",
12
+ "type": "commonjs",
13
+ "dependencies": {
14
+ "socket.io-client": "^4.8.3"
15
+ }
16
+ }