【摸鱼派脚本】聊天室团宠
食用方法
【摸鱼派脚本】聊天室小尾巴 自行查看
当前版本
v0.1.1
PS:
1、可以在聊天室发送 凌 令牌
获取令牌
2、token请勿随意泄露,且修改一次后不清理缓存的情况下无需多次修改;
3、目前没设计断线重连,下次一定。
脚本代码
已经是财富榜榜一了,我选择不再割韭菜,代码如下:
// ==UserScript== // @name Pet // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description try to thank APTX-4869! // @author (江户川-哀酱)APTX-4869 // @match https://fishpi.cn/cr // @icon https://www.google.com/s2/favicons?sz=64&domain=fishpi.cn // @grant GM_registerMenuCommand // ==/UserScript== (function() { 'use strict'; GM_registerMenuCommand("修改小宠物令牌", () => { var petToken = prompt("请输入小宠物令牌(eg:PET:TK:***************)", window.localStorage['petToken']); if (petToken === null) { return } else { } window.localStorage['petToken'] = petToken; window.location.reload() }); var petToken = window.localStorage['petToken']; // 添加小宠物渲染dom var personInfo = $(".side").eq(0).find(".person-info").eq(0); personInfo.after('<div class="module pet" style="width: 100%;height: 300px;overflow: hidden;"><div class=""><input type="text" style="width: 100%;height: 30px;padding: 5px 55px 5px 10px;box-sizing: border-box;border: 1px solid #eee;font-size: 12px;"></div>'); $(".pet").eq(0).append('<div id="petMsgList" style="width: 100%;height: 280px;overflow-y: scroll;"></div>'); var pet; let petWSS = { initPet: function() { pet = new WebSocket("wss://fish.elves.online/pet/" + Label.currentUser + "/" + petToken); let e; pet.onopen = function() { $("#petMsgList").append('<div class="allPetMsg" style="display: flex;margin: 10px 0;"><div class="ice-msg-content" style="position: relative;background-color: var(--background-secondary-color);border-radius: 5px;padding: 8px 15px;overflow: initial;max-width: 75%;font-size: 12px;box-sizing: border-box;">小宠物系统已连接...</div></div>'); e = setInterval(() => { pet.send(JSON.stringify({ type: "hb" })) }, 300000); }, pet.onclose = function() { randerError('小宠物系统已断开...') }, pet.onerror = function(e) { randerError('小宠物系统错误...') }, pet.onmessage = function(e) { console.info(e); renderPetMsg(e) } } } petWSS.initPet(); function renderPetMsg(e) { var content; var data = JSON.parse(e.data); if (data.type === "MSG") { content = data.msg } $("#petMsgList").prepend('<div class="allPetMsg" style="display: flex;margin: 10px 0;"><div class="ice-msg-content" style="position: relative;background-color: var(--background-secondary-color);border-radius: 5px;padding: 8px 15px;overflow: initial;max-width: 75%;font-size: 12px;box-sizing: border-box;">' + content + '</div></div>') } function randerError(message) { $("#petMsgList").prepend('<div class="allPetMsg" style="display: flex;margin: 10px 0;"><div class="ice-msg-content" style="position: relative;background-color: var(--background-secondary-color);border-radius: 5px;padding: 8px 15px;overflow: initial;max-width: 75%;font-size: 12px;box-sizing: border-box;">' + message + '</div></div>') } window.onbeforeunload = function(event) { pet.close() } // Your code here... })();
实际效果如下图:
-
脚本
哇 哀酱牛批
就写好了?
学单词捏
啊嘞,没看清上面的,积分-20😭