autoRes

七鱼自动回复

  1. // ==UserScript==
  2. // @name autoRes
  3. // @namespace http://tampermonkey.net/
  4. // @version 2025-02-10
  5. // @description 七鱼自动回复
  6. // @author You
  7. // @match https://mjhlwkjnjyxgs.qiyukf.com/chat/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=qiyukf.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. const CONFIG = {
  15. SCAN_INTERVAL: 30000, // 主扫描间隔30秒
  16. PARENT_CLASS: 'm-chat-sessionlist-item', // 父元素类名
  17. TARGET_CLASS: 'css-3kxpjb', // 目标元素类名
  18. MAX_RETRY: 3 // 失败重试次数
  19. };
  20. let statue = 0
  21. let intervalId
  22. let listRes = []
  23. const autoRes = ()=>{
  24. let mssage = document.querySelector('.ql-editor p')
  25. let Sbtn = document.querySelector('.ant-btn.ant-btn-primary.ant-btn-compact-item.ant-btn-compact-first-item')
  26. if(mssage){
  27. mssage.textContent = "稍等";
  28. setTimeout(() => {
  29. Sbtn.click();
  30. }, 1000);
  31.  
  32. }else{
  33. console.log("未收到新消息")
  34. }
  35. }
  36. const performScan =()=>{
  37. const parents = document.getElementsByClassName(CONFIG.PARENT_CLASS);
  38. listRes = [];
  39. // 遍历父元素收集目标
  40. Array.from(parents).forEach(parent => {
  41. const target = parent.querySelector(`.${CONFIG.TARGET_CLASS}`);
  42. if(target){
  43. listRes.push(target)
  44. }else{
  45. console.log("不是新消息")
  46. }
  47. });
  48. if(listRes.length != 0){
  49. for(let i = 0 ; i < listRes.length;I++){
  50. listRes[i].click();
  51. setTimeout(() => {
  52. autoRes()
  53. }, 1000);
  54.  
  55. }
  56. }
  57. }
  58. const btn = document.createElement('button');
  59.  
  60. // 基础样式设置
  61. btn.style.cssText = `
  62. position: fixed;
  63. bottom: 20px;
  64. right: 20px;
  65. width: 50px;
  66. height: 50px;
  67. border-radius: 50%;
  68. background: #2196F3;
  69. color: white;
  70. border: none;
  71. cursor: pointer;
  72. box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  73. z-index: 9999;
  74. font-size: 16px;
  75. transition: all 0.3s;
  76. `;
  77.  
  78. // 悬停效果
  79. btn.addEventListener('mouseover', () => {
  80. btn.style.transform = 'scale(1.1)';
  81. btn.style.background = '#1976D2';
  82. });
  83.  
  84. btn.addEventListener('mouseout', () => {
  85. btn.style.transform = 'scale(1)';
  86. btn.style.background = '#2196F3';
  87. });
  88.  
  89. // 点击事件示例
  90. btn.addEventListener('click', () => {
  91. if(statue == 0){
  92. btn.innerHTML = 'runing'
  93. console.log("开始运行")
  94. statue =1
  95. performScan()
  96. intervalId = setInterval(performScan, 30000);
  97. }else{
  98. clearInterval(intervalId);
  99. intervalId = null;
  100. statue =0;
  101. btn.innerHTML = 'stop';
  102. console.log("停止运行")
  103. }
  104. //autoRes()
  105. // 在这里添加你的自定义功能
  106. });
  107.  
  108. // 添加按钮到页面
  109. document.body.appendChild(btn);
  110.  
  111. // 可选:添加按钮文字/图标
  112. btn.innerHTML = 'stop'; // 使用闪电符号作为示例
  113. // Your code here...
  114. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址