diff --git a/bot2022.db/002790.log b/bot2022.db/002790.log deleted file mode 100644 index 8e46fc1..0000000 Binary files a/bot2022.db/002790.log and /dev/null differ diff --git a/bot2022.db/002791.ldb b/bot2022.db/002791.ldb deleted file mode 100644 index 4752201..0000000 Binary files a/bot2022.db/002791.ldb and /dev/null differ diff --git a/bot2022.db/002969.ldb b/bot2022.db/002969.ldb new file mode 100644 index 0000000..dafef12 Binary files /dev/null and b/bot2022.db/002969.ldb differ diff --git a/bot2022.db/002971.ldb b/bot2022.db/002971.ldb new file mode 100644 index 0000000..409e204 Binary files /dev/null and b/bot2022.db/002971.ldb differ diff --git a/bot2022.db/002972.log b/bot2022.db/002972.log new file mode 100644 index 0000000..e1513b2 Binary files /dev/null and b/bot2022.db/002972.log differ diff --git a/bot2022.db/CURRENT b/bot2022.db/CURRENT index 1f4e9e5..e09cdc6 100644 --- a/bot2022.db/CURRENT +++ b/bot2022.db/CURRENT @@ -1 +1 @@ -MANIFEST-002788 +MANIFEST-002970 diff --git a/bot2022.db/LOG b/bot2022.db/LOG index 18ce8ff..680c7c8 100644 --- a/bot2022.db/LOG +++ b/bot2022.db/LOG @@ -1,11 +1,5 @@ -2022/06/04-19:29:26.141465 7faef7fff700 Recovering log #2785 -2022/06/04-19:29:26.154647 7faef7fff700 Level-0 table #2789: started -2022/06/04-19:29:26.165333 7faef7fff700 Level-0 table #2789: 36522 bytes OK -2022/06/04-19:29:26.177033 7faef7fff700 Delete type=3 #2781 -2022/06/04-19:29:26.177100 7faef7fff700 Delete type=0 #2785 -2022/06/04-19:33:32.237358 7faef6d09700 Compacting 1@0 + 1@1 files -2022/06/04-19:33:32.254642 7faef6d09700 Generated table #2791@0: 8551 keys, 408700 bytes -2022/06/04-19:33:32.254728 7faef6d09700 Compacted 1@0 + 1@1 files => 408700 bytes -2022/06/04-19:33:32.260616 7faef6d09700 compacted to: files[ 0 1 0 0 0 0 0 ] -2022/06/04-19:33:32.260811 7faef6d09700 Delete type=2 #2789 -2022/06/04-19:33:32.261025 7faef6d09700 Delete type=2 #2787 +2022/07/08-02:23:44.101244 7f4febfff700 Recovering log #2967 +2022/07/08-02:23:44.107787 7f4febfff700 Level-0 table #2971: started +2022/07/08-02:23:44.115393 7f4febfff700 Level-0 table #2971: 49620 bytes OK +2022/07/08-02:23:44.126540 7f4febfff700 Delete type=0 #2967 +2022/07/08-02:23:44.127313 7f4febfff700 Delete type=3 #2960 diff --git a/bot2022.db/LOG.old b/bot2022.db/LOG.old index 24f14fd..ed45352 100644 --- a/bot2022.db/LOG.old +++ b/bot2022.db/LOG.old @@ -1,20 +1,29 @@ -2022/06/03-08:43:48.822914 7f7c737fe700 Recovering log #2779 -2022/06/03-08:43:48.872382 7f7c737fe700 Level-0 table #2782: started -2022/06/03-08:43:48.887981 7f7c737fe700 Level-0 table #2782: 176854 bytes OK -2022/06/03-08:43:48.893873 7f7c737fe700 Delete type=3 #2777 -2022/06/03-08:43:48.893929 7f7c737fe700 Delete type=0 #2779 -2022/06/03-08:47:06.934097 7f7c71ffb700 Compacting 1@0 + 1@1 files -2022/06/03-08:47:06.956926 7f7c71ffb700 Generated table #2784@0: 8439 keys, 406891 bytes -2022/06/03-08:47:06.956945 7f7c71ffb700 Compacted 1@0 + 1@1 files => 406891 bytes -2022/06/03-08:47:06.957597 7f7c71ffb700 compacted to: files[ 0 1 0 0 0 0 0 ] -2022/06/03-08:47:06.957752 7f7c71ffb700 Delete type=2 #2780 -2022/06/03-08:47:06.958186 7f7c71ffb700 Delete type=2 #2782 -2022/06/04-16:57:02.852650 7f7c71ffb700 Level-0 table #2786: started -2022/06/04-16:57:02.930114 7f7c71ffb700 Level-0 table #2786: 461206 bytes OK -2022/06/04-16:57:02.936040 7f7c71ffb700 Delete type=0 #2783 -2022/06/04-17:02:02.847864 7f7c71ffb700 Compacting 1@0 + 1@1 files -2022/06/04-17:02:02.902929 7f7c71ffb700 Generated table #2787@0: 8544 keys, 405308 bytes -2022/06/04-17:02:02.902963 7f7c71ffb700 Compacted 1@0 + 1@1 files => 405308 bytes -2022/06/04-17:02:02.913134 7f7c71ffb700 compacted to: files[ 0 1 0 0 0 0 0 ] -2022/06/04-17:02:02.913631 7f7c71ffb700 Delete type=2 #2784 -2022/06/04-17:02:02.915502 7f7c71ffb700 Delete type=2 #2786 +2022/07/05-08:15:14.787673 7ff18a7fc700 Recovering log #2958 +2022/07/05-08:15:14.825381 7ff18a7fc700 Level-0 table #2961: started +2022/07/05-08:15:14.846109 7ff18a7fc700 Level-0 table #2961: 218251 bytes OK +2022/07/05-08:15:14.851498 7ff18a7fc700 Delete type=3 #2956 +2022/07/05-08:15:14.851538 7ff18a7fc700 Delete type=0 #2958 +2022/07/05-08:19:38.925992 7ff16bfff700 Compacting 1@0 + 1@1 files +2022/07/05-08:19:38.958589 7ff16bfff700 Generated table #2963@0: 10606 keys, 519653 bytes +2022/07/05-08:19:38.958618 7ff16bfff700 Compacted 1@0 + 1@1 files => 519653 bytes +2022/07/05-08:19:38.960021 7ff16bfff700 compacted to: files[ 0 1 0 0 0 0 0 ] +2022/07/05-08:19:38.962113 7ff16bfff700 Delete type=2 #2961 +2022/07/05-08:19:38.962375 7ff16bfff700 Delete type=2 #2959 +2022/07/06-14:28:39.689047 7ff16bfff700 Level-0 table #2965: started +2022/07/06-14:28:39.759957 7ff16bfff700 Level-0 table #2965: 472777 bytes OK +2022/07/06-14:28:39.764050 7ff16bfff700 Delete type=0 #2962 +2022/07/06-14:33:39.696459 7ff16bfff700 Compacting 1@0 + 1@1 files +2022/07/06-14:33:39.737381 7ff16bfff700 Generated table #2966@0: 10709 keys, 521000 bytes +2022/07/06-14:33:39.737399 7ff16bfff700 Compacted 1@0 + 1@1 files => 521000 bytes +2022/07/06-14:33:39.738183 7ff16bfff700 compacted to: files[ 0 1 0 0 0 0 0 ] +2022/07/06-14:33:39.738326 7ff16bfff700 Delete type=2 #2965 +2022/07/06-14:33:39.738467 7ff16bfff700 Delete type=2 #2963 +2022/07/07-22:53:11.772316 7ff16bfff700 Level-0 table #2968: started +2022/07/07-22:53:11.810371 7ff16bfff700 Level-0 table #2968: 461977 bytes OK +2022/07/07-22:53:11.815836 7ff16bfff700 Delete type=0 #2964 +2022/07/07-22:58:13.583522 7ff16bfff700 Compacting 1@0 + 1@1 files +2022/07/07-22:58:13.611342 7ff16bfff700 Generated table #2969@0: 10811 keys, 529525 bytes +2022/07/07-22:58:13.611367 7ff16bfff700 Compacted 1@0 + 1@1 files => 529525 bytes +2022/07/07-22:58:13.612600 7ff16bfff700 compacted to: files[ 0 1 0 0 0 0 0 ] +2022/07/07-22:58:13.612810 7ff16bfff700 Delete type=2 #2966 +2022/07/07-22:58:13.613315 7ff16bfff700 Delete type=2 #2968 diff --git a/bot2022.db/MANIFEST-002788 b/bot2022.db/MANIFEST-002788 deleted file mode 100644 index 2e38c1d..0000000 Binary files a/bot2022.db/MANIFEST-002788 and /dev/null differ diff --git a/bot2022.db/MANIFEST-002970 b/bot2022.db/MANIFEST-002970 new file mode 100644 index 0000000..68706d6 Binary files /dev/null and b/bot2022.db/MANIFEST-002970 differ diff --git a/src/Bot.js b/src/Bot.js index 4fbf949..ef4de30 100644 --- a/src/Bot.js +++ b/src/Bot.js @@ -20,6 +20,8 @@ module.exports = class Bot extends StaticEventEmitter { this.prefix = "/"; // never change this this.loadCommands(); + + MPPClient.client.sendArray([{m: "+custom"}]); } static bindEventListeners() { @@ -37,6 +39,22 @@ module.exports = class Bot extends StaticEventEmitter { this.on("chat.send", msg => { MPPClient.sendChat(msg); }); + + this.on("custom", msg => { + console.log(this.getRank(msg.p)); + if (this.getRank(msg.p) !== 'admin') return; + if (!('m' in msg.data)) return; + if (msg.data.m == "?color") { + if (!('_id' in msg.data)) msg.data._id = msg.p; + if (!('color' in msg.data)) return; + MPPClient.sendArray([{ + m: "setcolor", + id: msg.data._id, + color: msg.data.color + }]); + console.log("Forcefully changing color of " + msg.p.substring(0, 6) + " to " + msg.data.color + "."); + } + }); } static runCommand(msg) { diff --git a/test.js b/test.js index fc81df0..12bb6d7 100644 --- a/test.js +++ b/test.js @@ -11,29 +11,84 @@ client.setChannel("test/fishing"); // // let _id = "fb1573d271464fef2ff4be93"; -let _id = "8107156a27514cebcb65195d"; +// let _id = "8107156a27514cebcb65195d"; + +// let _id = "ead940199c7d9717e5149919"; +// let _id = "2cbb36e9a48bcc5658b5723b"; +// let _id = "50b0903e19cda807c526d95b"; +// let _id = "ead940199c7d9717e5149919"; +// let _id = "8aa91b66206af59b6cf3b3a7"; +// let _id = "732e436aba2d6d82d08fddc6"; +// let _id = "6bae31ea468c8e63534e5783"; + +// let _id = "78a11a25c966d62d0231a135" // nmpb bot +// let _id = "123123ae93b89e4270cf6ee9" // camel +// let _id = "b40df99cc2ca6f503fba77cb"; // bouncer +// let _id = "4d354eaddf02eedc6211034c"; // theta +// let _id = "50b0903e19cda807c526d95b"; // sola +let _id = "69bb36e9a48bcc5658b5723b"; // wolfy corn bot function rrggbbrand(){var a = Math.floor(Math.random() * 256).toString(16); return a.length < 2 ? "0"+a : a}; +function hslToHex(h, s, l) { + l /= 100; + const a = s * Math.min(l, 1 - l) / 100; + const f = n => { + const k = (n + h / 30) % 12; + const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); + return Math.round(255 * color).toString(16).padStart(2, '0'); // convert to Hex and prefix "0" if needed + }; + return `#${f(0)}${f(8)}${f(4)}`; +} client.on("ch", () => { // let color = `#${rrggbbrand()}${rrggbbrand()}${rrggbbrand()}`; // console.log(color); // client.sendArray([{m:'setcolor', _id:_id, color:color}]); // client.sendArray([{m:'setcolor', _id:_id, color:""}]); - // setInterval(() => { - // client.sendArray([{m:'setname', _id:_id, name:"Not Lapis"}]); - // client.sendArray([{m:'setname', _id:_id2, name: "Not Lapis"}]) - // process.exit(); - // }, 25); + // + /* + let h = 0; + let s = 100; + let l = 50; + + let hex = "#000000"; + + setInterval(() => { + h += 0.5; + if (h > 360) h = 0; + }, 1000 / 60); + + setInterval(() => { + hex = hslToHex(h, s, l); + client.sendArray([{m: 'setcolor', _id: _id, color: hex}]); + + // client.sendArray([{m:'setname', _id:_id, name:"Not Lapis"}]); + // client.sendArray([{m:'setname', _id:_id2, name: "Not Lapis"}]) + // process.exit(); + + }, 1000 / 2); + */ - client.sendArray([{m:"setname", _id:_id, name:"낚시 앱 [/help]"}]); + // client.sendArray([{m:"setname", _id:_id, name:"낚시 앱 [/help]"}]); + // client.sendArray([{m: "setname", _id: _id, name: "kake fartz owo"}]) + // client.sendArray([{m: "setname", _id: _id, name: "๖ۣۜH͜r̬i͡7566's NMPB"}]) + // client.sendArray([{m: 'setname', _id: _id, name: "hi 123123"}]) // client.sendArray([{m: "settag", _id: "ead940199c7d9717e5149919", tag: { text: "hri", color: "#9900ff" }}]) + // client.sendArray([{m: "setname", _id: _id, name: "Bouncer [//help]"}]); + // client.sendArray([{m: "setcolor", _id: _id, color: "#8d3f50"}]); + // client.sendArray([{m: "setname", _id: _id, name: "🎅 a bot [=help] ❄️"}]); + // client.sendArray([{m: "setname", _id: _id, name: "sola"}]); + client.sendArray([{m: "setcolor", _id: "_id", color: "#f8f560"}]) + + // setInterval(() => { + // client.sendArray([{m: "setname", _id: _id, name: "Anonymous"}]); + // }, 1000); // for (let p of Object.values(client.ppl)) { // let name = p.name + " 😩"; // client.sendArray([{m:'setname', _id: p._id, name:name}]); // } - process.exit(); + // process.exit(); });