Merge remote-tracking branch 'refs/remotes/yeyang52/master'

# Conflicts:
#	.github/ISSUE_TEMPLATE/\u202e
#	.gitignore
This commit is contained in:
2024-08-02 00:41:34 +08:00
6 changed files with 27 additions and 20 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,5 @@ test.*
.vscode/
temp/
*.css.map
pnpm-lock.yaml
.idea/

View File

@@ -1,7 +1,7 @@
#!/bin/sh
echo -e "\e[1;33m-----------代码正在ESLint格式化-----------\e[0m"
echo "-----------代码正在ESLint格式化-----------"
pnpm run lint
echo -e "\e[1;32m-------------代码格式化完成---------------\e[0m"
echo "-------------代码格式化完成---------------"

View File

@@ -173,9 +173,9 @@ Bot.on?.("message", async(e) => {
await common.sendMasterMsg(msg, (e.bot ?? Bot).uin)
if (forwardMsg) await common.sendMasterMsg(forwardMsg, (e.bot ?? Bot).uin)
})
// 特殊消息处理
/**
*
* 特殊消息处理
* @param msg
*/
function getMsgType(msg) {

View File

@@ -168,14 +168,16 @@ export class GroupAdmin extends plugin {
let qq = e.message.find(item => item.type == "at")?.qq
const type = /设置管理/.test(e.msg)
if (!qq) qq = e.msg.replace(/#|(设置|取消)管理/g, "").trim()
if (!qq || !(/\d{5,}/.test(qq))) return e.reply("❎ 请输入正确的QQ号")
const Member = e.group.pickMember(Number(qq) || qq)
let Member;
try {
Member = e.group.pickMember(Number(qq) || qq, true)
} catch {
return e.reply("❎ 这个群没有这个人哦~")
}
const Memberinfo = Member?.info || await Member?.getInfo?.()
if (!Memberinfo) return e.reply("❎ 这个群没有这个人哦~")
const res = await e.group.setAdmin(qq, type)
const name = Memberinfo.card || Memberinfo.nickname
const name = Memberinfo.card || Memberinfo.nickname || (Number(qq) || qq)
if (!res) return e.reply("❎ 未知错误")
type ? e.reply(`✅ 已经把「${name}」设置为管理啦!!`) : e.reply(`✅ 已取消「${name}」的管理`)
}

View File

@@ -2,6 +2,10 @@ import { funApi, common, memes } from "../model/index.js"
import _ from "lodash"
import { Config } from "../components/index.js"
Bot.on("message.group", e => {
if (e?.message?.[0]?.text == "#全部赞我") { (new ThumbUp()).thumbUp(e) }
})
export class ThumbUp extends plugin {
constructor(e) {
super({
@@ -15,7 +19,6 @@ export class ThumbUp extends plugin {
}
]
})
if (e?.message?.[0]?.text == "#全部赞我") { this.thumbUp(e) }
}
/**
@@ -23,6 +26,7 @@ export class ThumbUp extends plugin {
* @param e
*/
async thumbUp(e) {
const message = e.msg || e.message?.[0]?.text
const DO_ZAN = "赞"
const DO_CHAO = "超"
let doType = DO_ZAN
@@ -31,12 +35,12 @@ export class ThumbUp extends plugin {
// 使用数组和includes方法的正确用法
const forbiddenWords = [ "超", "操", "草", "抄", "吵", "炒" ]
if (forbiddenWords.some(word => e.msg.includes(word))) {
if (forbiddenWords.some(word => message.includes(word))) {
doType = DO_CHAO
}
const atWords = [ "他", "她", "它", "TA", "ta", "Ta" ]
if (e.at && atWords.some(word => e.msg.includes(word))) {
if (e.at && atWords.some(word => message.includes(word))) {
userId = e.at
isSelf = false
}
@@ -44,7 +48,7 @@ export class ThumbUp extends plugin {
let isFriend = await (e.bot ?? Bot).fl.get(userId)
let allowLikeByStrangers = Config.whole.Strangers_love
if (!isFriend && !allowLikeByStrangers) {
return (e.message?.[0]?.text == "#全部赞我") ? false : e.reply(`不加好友不${doType}🙄`, true)
return (message == "#全部赞我") ? false : e.reply(`不加好友不${doType}🙄`, true)
}
/** 执行点赞 */
@@ -80,7 +84,7 @@ export class ThumbUp extends plugin {
const successFn = _.sample([ "ganyu", "zan" ])
const mention = segment.at(userId)
if (e.message?.[0]?.text == "#全部赞我")failsMsg = "return"
if (message == "#全部赞我")failsMsg = "return"
/** 判断点赞是否成功 */
let msg = await generateResponseMsg(n > 0, successMsg, failsMsg, avatar, successFn, mention)

View File

@@ -25,18 +25,18 @@
"colorthief": "^2.4.0",
"jimp": "^0.22.12",
"node-fetch": "^3.3.2",
"systeminformation": "^5.22.11"
"systeminformation": "^5.23.2"
},
"devDependencies": {
"all-contributors-cli": "^6.26.1",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.9",
"eslint-plugin-promise": "^6.2.0",
"gitmoji-cli": "^9.2.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.6"
"eslint-plugin-jsdoc": "^48.10.2",
"eslint-plugin-promise": "^6.6.0",
"gitmoji-cli": "^9.4.0",
"husky": "^9.1.4",
"lint-staged": "^15.2.7"
},
"optionalDependencies": {
"abort-controller": "^3.0.0"