细节优化
This commit is contained in:
		
							parent
							
								
									7492ae49a1
								
							
						
					
					
						commit
						ab1b270c96
					
				| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
# 日志等级:trace,debug,info,warn,fatal,mark,error,off
 | 
					# 日志等级:trace,debug,info,warn,fatal,mark,error,off
 | 
				
			||||||
# mark时只显示执行命令,不显示聊天记录
 | 
					# mark时只显示执行命令,不显示聊天记录
 | 
				
			||||||
log_level: info
 | 
					log_level: info
 | 
				
			||||||
# HTTP 端口
 | 
					# 服务器端口
 | 
				
			||||||
port: 2536
 | 
					port: 2536
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# chromium其他路径
 | 
					# chromium其他路径
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,25 +107,19 @@ export default class Yunzai extends EventEmitter {
 | 
				
			||||||
    user_id = Number(user_id) || String(user_id)
 | 
					    user_id = Number(user_id) || String(user_id)
 | 
				
			||||||
    const user = this.fl.get(user_id)
 | 
					    const user = this.fl.get(user_id)
 | 
				
			||||||
    if (user) return this[user.bot_id].pickFriend(user_id)
 | 
					    if (user) return this[user.bot_id].pickFriend(user_id)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    logger.error(`获取用户对象失败:找不到用户 ${logger.red(user_id)}`)
 | 
					    logger.error(`获取用户对象失败:找不到用户 ${logger.red(user_id)}`)
 | 
				
			||||||
    return false
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pickGroup(group_id) {
 | 
					  pickGroup(group_id) {
 | 
				
			||||||
    group_id = Number(group_id) || String(group_id)
 | 
					    group_id = Number(group_id) || String(group_id)
 | 
				
			||||||
    const group = this.gl.get(group_id)
 | 
					    const group = this.gl.get(group_id)
 | 
				
			||||||
    if (group) return this[group.bot_id].pickGroup(group_id)
 | 
					    if (group) return this[group.bot_id].pickGroup(group_id)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    logger.error(`获取群对象失败:找不到群 ${logger.red(group_id)}`)
 | 
					    logger.error(`获取群对象失败:找不到群 ${logger.red(group_id)}`)
 | 
				
			||||||
    return false
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pickMember(group_id, user_id) {
 | 
					  pickMember(group_id, user_id) {
 | 
				
			||||||
    const group = this.pickGroup(group_id)
 | 
					    const group = this.pickGroup(group_id)
 | 
				
			||||||
    if (group) return group.pickMember(user_id)
 | 
					    if (group) return group.pickMember(user_id)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    return false
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sendFriendMsg(bot_id, user_id, msg) {
 | 
					  sendFriendMsg(bot_id, user_id, msg) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -494,9 +494,9 @@ class PluginsLoader {
 | 
				
			||||||
          msg = [segment.reply(e.message_id), msg]
 | 
					          msg = [segment.reply(e.message_id), msg]
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let msgRes
 | 
					      let res
 | 
				
			||||||
      try {
 | 
					      try {
 | 
				
			||||||
        msgRes = await e.replyNew(msg)
 | 
					        res = await e.replyNew(msg)
 | 
				
			||||||
      } catch (err) {
 | 
					      } catch (err) {
 | 
				
			||||||
        if (typeof msg != "string")
 | 
					        if (typeof msg != "string")
 | 
				
			||||||
          msg = lodash.truncate(JSON.stringify(msg), { length: 300 })
 | 
					          msg = lodash.truncate(JSON.stringify(msg), { length: 300 })
 | 
				
			||||||
| 
						 | 
					@ -504,19 +504,23 @@ class PluginsLoader {
 | 
				
			||||||
        logger.error(err)
 | 
					        logger.error(err)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (recallMsg > 0 && msgRes?.message_id) {
 | 
					      if (recallMsg > 0 && res?.message_id) {
 | 
				
			||||||
        if (e.group?.recallMsg)
 | 
					        if (e.group?.recallMsg)
 | 
				
			||||||
          setTimeout(() =>
 | 
					          setTimeout(() => {
 | 
				
			||||||
            e.group.recallMsg(msgRes.message_id),
 | 
					            e.group.recallMsg(res.message_id)
 | 
				
			||||||
          recallMsg * 1000)
 | 
					            if (e.message_id)
 | 
				
			||||||
 | 
					              e.group.recallMsg(e.message_id)
 | 
				
			||||||
 | 
					          }, recallMsg * 1000)
 | 
				
			||||||
        else if (e.friend?.recallMsg)
 | 
					        else if (e.friend?.recallMsg)
 | 
				
			||||||
          setTimeout(() =>
 | 
					          setTimeout(() => {
 | 
				
			||||||
            e.friend.recallMsg(msgRes.message_id),
 | 
					            e.friend.recallMsg(res.message_id)
 | 
				
			||||||
          recallMsg * 1000)
 | 
					            if (e.message_id)
 | 
				
			||||||
 | 
					              e.friend.recallMsg(e.message_id)
 | 
				
			||||||
 | 
					          }, recallMsg * 1000)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.count(e, msg)
 | 
					      this.count(e, msg)
 | 
				
			||||||
      return msgRes
 | 
					      return res
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,8 +187,8 @@ Bot.adapter.push(new class gocqhttpAdapter {
 | 
				
			||||||
        guild_id: guild.guild_id,
 | 
					        guild_id: guild.guild_id,
 | 
				
			||||||
      })))
 | 
					      })))
 | 
				
			||||||
        array.push({
 | 
					        array.push({
 | 
				
			||||||
          ...guild,
 | 
					          guild,
 | 
				
			||||||
          ...channel,
 | 
					          channel,
 | 
				
			||||||
          group_id: `${guild.guild_id}-${channel.channel_id}`,
 | 
					          group_id: `${guild.guild_id}-${channel.channel_id}`,
 | 
				
			||||||
          group_name: `${guild.guild_name}-${channel.channel_name}`,
 | 
					          group_name: `${guild.guild_name}-${channel.channel_name}`,
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ const list = {
 | 
				
			||||||
  "TRSS-Plugin"   :"https://Yunzai.TRSS.me",
 | 
					  "TRSS-Plugin"   :"https://Yunzai.TRSS.me",
 | 
				
			||||||
  "yenai-plugin"  :"https://gitee.com/yeyang52/yenai-plugin",
 | 
					  "yenai-plugin"  :"https://gitee.com/yeyang52/yenai-plugin",
 | 
				
			||||||
  "flower-plugin" :"https://gitee.com/Nwflower/flower-plugin",
 | 
					  "flower-plugin" :"https://gitee.com/Nwflower/flower-plugin",
 | 
				
			||||||
 | 
					  "xianyu-plugin" :"https://gitee.com/suancaixianyu/xianyu-plugin",
 | 
				
			||||||
  "earth-k-plugin":"https://gitee.com/SmallK111407/earth-k-plugin",
 | 
					  "earth-k-plugin":"https://gitee.com/SmallK111407/earth-k-plugin",
 | 
				
			||||||
  "useless-plugin":"https://gitee.com/SmallK111407/useless-plugin",
 | 
					  "useless-plugin":"https://gitee.com/SmallK111407/useless-plugin",
 | 
				
			||||||
  "StarRail-plugin"   :"https://gitee.com/hewang1an/StarRail-plugin",
 | 
					  "StarRail-plugin"   :"https://gitee.com/hewang1an/StarRail-plugin",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue