📝 constants
This commit is contained in:
@@ -43,7 +43,9 @@ const NoticeCfgType = {
|
||||
输入: 'input'
|
||||
}
|
||||
/** 分开开关和数字 */
|
||||
const SwitchCfgType = { ...NoticeCfgType, ...OtherCfgType, ...SeSeCfgType }
|
||||
const SwitchCfgType = {
|
||||
...NoticeCfgType, ...OtherCfgType, ...SeSeCfgType
|
||||
}
|
||||
const NumberCfgType = {
|
||||
渲染精度: {
|
||||
key: 'renderScale',
|
||||
@@ -56,7 +58,9 @@ const NumberCfgType = {
|
||||
}
|
||||
|
||||
/** 支持单独设置的项 */
|
||||
const aloneKeys = ['群消息', '群临时消息', '群撤回', '群邀请', '群管理变动', '群聊列表变动', '群成员变动', '加群通知', '禁言', '闪照', '匿名', '涩涩', '涩涩pro']
|
||||
const aloneKeys = [
|
||||
'群消息', '群临时消息', '群撤回', '群邀请', '群管理变动', '群聊列表变动', '群成员变动', '加群通知', '禁言', '闪照', '匿名', '涩涩', '涩涩pro'
|
||||
]
|
||||
|
||||
const SwitchCfgReg = new RegExp(`^#椰奶设置(${Object.keys(SwitchCfgType).join('|')})(单独)?(开启|关闭|取消)$`)
|
||||
const NumberCfgReg = new RegExp(`^#椰奶设置(${Object.keys(NumberCfgType).join('|')})(\\d+)秒?$`)
|
||||
|
||||
129
apps/fun.js
129
apps/fun.js
@@ -4,14 +4,8 @@ import _ from 'lodash'
|
||||
import { Config } from '../components/index.js'
|
||||
import { common, uploadRecord, QQApi, funApi } from '../model/index.js'
|
||||
import { xiurenTypeId } from '../model/api/funApi.js'
|
||||
const heisiType = {
|
||||
白丝: { type: 'baisi', page: 17 },
|
||||
黑丝: { type: 'heisi', page: 43 },
|
||||
巨乳: { type: 'juru', page: 8 },
|
||||
jk: { type: 'jk', page: 6 },
|
||||
网红: { type: 'mcn', page: 36 },
|
||||
美足: { type: 'meizu', page: 9 }
|
||||
}
|
||||
import { successImgs, faildsImgs, heisiType } from '../constants/fun.js'
|
||||
|
||||
/** API请求错误文案 */
|
||||
const API_ERROR = '❎ 出错辣,请稍后重试'
|
||||
/** 未启用文案 */
|
||||
@@ -51,7 +45,7 @@ export class Fun extends plugin {
|
||||
},
|
||||
{
|
||||
reg: '^#?(我要|给我)?(资料卡)?(点赞|赞我)$',
|
||||
fnc: 'zan'
|
||||
fnc: 'thumbUp'
|
||||
},
|
||||
{
|
||||
reg: 'github.com/[a-zA-Z0-9-]{1,39}/[a-zA-Z0-9_-]{1,100}',
|
||||
@@ -116,85 +110,59 @@ export class Fun extends plugin {
|
||||
|
||||
/** 有道翻译 */
|
||||
async youdao (e) {
|
||||
let msg = e.msg.match(/#(([\u4e00-\u9fa5]{2,6})-)?([\u4e00-\u9fa5]{2,6})?翻译(.*)/)
|
||||
if (!msg) return
|
||||
const msg = e.msg.match(/#(([\u4e00-\u9fa5]{2,6})-)?([\u4e00-\u9fa5]{2,6})?翻译(.*)/)
|
||||
// 如果是在群聊中回复,则获取上一条消息作为翻译内容
|
||||
if (e.source) {
|
||||
let source
|
||||
if (e.isGroup) {
|
||||
source = (await e.group.getChatHistory(e.source.seq, 1)).pop()
|
||||
} else {
|
||||
source = (await e.friend.getChatHistory(e.source.time, 1)).pop()
|
||||
}
|
||||
msg[4] = source.message.filter(item => item.type == 'text').map(item => item.text).join('')
|
||||
}
|
||||
const source = e.isGroup
|
||||
? (await e.group.getChatHistory(e.source.seq, 1)).pop()
|
||||
: (await e.friend.getChatHistory(e.source.time, 1)).pop()
|
||||
|
||||
let results = await funApi.youdao(msg[4], msg[3], msg[2])
|
||||
return e.reply(results, true)
|
||||
msg[4] = source.message
|
||||
.filter(item => item.type === 'text')
|
||||
.map(item => item.text).join('')
|
||||
}
|
||||
const results = await funApi.youdao(msg[4], msg[3], msg[2])
|
||||
e.reply(results, true)
|
||||
}
|
||||
|
||||
/** 点赞 */
|
||||
async zan (e) {
|
||||
async thumbUp (e) {
|
||||
if (Bot.config.platform == 3) return e.reply('❎ 手表协议暂不支持点赞请更换协议后重试')
|
||||
/** 判断是否为好友 */
|
||||
let isFriend = await Bot.fl.get(e.user_id)
|
||||
let likeByStrangers = Config.Notice.Strangers_love
|
||||
if (!isFriend && !likeByStrangers) return e.reply('不加好友不点🙄', true)
|
||||
/** 点赞成功回复的图片 */
|
||||
let successImgs = [
|
||||
'https://api.caonm.net/api/zan/z.php?qq=',
|
||||
'http://api.caonm.net/api/bix/b.php?qq=',
|
||||
'http://api.caonm.net/api/kan/kan_3.php?qq=',
|
||||
'https://api.caonm.net/api/kan/kan.php?qq='
|
||||
]
|
||||
let faildsImgs = [
|
||||
'https://ovooa.caonm.net/API/pa/api.php?QQ=',
|
||||
'https://api.caonm.net/api/ti/t.php?qq=',
|
||||
'https://api.caonm.net/api/gun/index.php?qq=',
|
||||
'https://api.caonm.net/api/gund/g.php?qq='
|
||||
]
|
||||
let allowLikeByStrangers = Config.Notice.Strangers_love
|
||||
if (!isFriend && !allowLikeByStrangers) return e.reply('不加好友不点🙄', true)
|
||||
/** 点赞成功的图片 */
|
||||
let successImg = segment.image(_.sample(successImgs) + e.user_id)
|
||||
|
||||
/** 点赞失败的图片 */
|
||||
let faildsImg = segment.image(_.sample(faildsImgs) + e.user_id)
|
||||
|
||||
/** 执行点赞 */
|
||||
let n = 0
|
||||
let failsmsg = '今天已经点过了,还搁这讨赞呢!!!'
|
||||
let failsMsg = '今天已经点过了,还搁这讨赞呢!!!'
|
||||
while (true) {
|
||||
// 好友点赞
|
||||
if (!likeByStrangers || isFriend) {
|
||||
let res = await Bot.sendLike(e.user_id, 10)
|
||||
logger.debug(`${e.logFnc}好友点赞`, res)
|
||||
if (res) {
|
||||
n += 10
|
||||
} else break
|
||||
} else {
|
||||
// 陌生人点赞
|
||||
let res = await QQApi.thumbUp(e.user_id, 10)
|
||||
logger.debug(`${e.logFnc}陌生人点赞`, res)
|
||||
if (res.code != 0) {
|
||||
if (res.code == 1) {
|
||||
failsmsg = '点赞失败,请检查是否开启陌生人点赞或添加好友'
|
||||
} else {
|
||||
failsmsg = res.msg
|
||||
}
|
||||
break
|
||||
let res = await QQApi.thumbUp(e.user_id, 10)
|
||||
logger.debug(`${e.logFnc}给${e.user_id}点赞`, res)
|
||||
if (res.code != 0) {
|
||||
if (res.code == 1) {
|
||||
failsMsg = '点赞失败,请检查是否开启陌生人点赞或添加好友'
|
||||
} else {
|
||||
n += 10
|
||||
failsMsg = res.msg
|
||||
}
|
||||
break
|
||||
} else {
|
||||
n += 10
|
||||
}
|
||||
}
|
||||
|
||||
let successMsg = `给你点了${n}下哦,记得回我~ ${isFriend ? '' : '(如点赞失败请添加好友)'}`
|
||||
/** 回复的消息 */
|
||||
let successResult = ['\n', `给你点了${n}下哦,记得回我~${isFriend ? '' : '(如点赞失败请添加好友)'}`, successImg]
|
||||
let faildsResult = ['\n', failsmsg, faildsImg]
|
||||
let successResult = ['\n', successMsg, successImg]
|
||||
let faildsResult = ['\n', failsMsg, faildsImg]
|
||||
|
||||
/** 判断点赞是否成功 */
|
||||
let msg = n > 0 ? successResult : faildsResult
|
||||
/** 回复 */
|
||||
await e.reply(msg, false, { at: true })
|
||||
|
||||
return true
|
||||
e.reply(msg, false, { at: true })
|
||||
}
|
||||
|
||||
// github
|
||||
@@ -210,36 +178,31 @@ export class Fun extends plugin {
|
||||
const [user, repo] = [res[1], res[2].split('#')[0]]
|
||||
e.reply(segment.image(`${api}/${id}/${user}/${repo}`))
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// coser
|
||||
async coser (e) {
|
||||
let { sese, sesepro } = Config.getGroup(e.group_id)
|
||||
if (!sese && !sesepro && !e.isMaster) return e.reply(SWITCH_ERROR)
|
||||
const { sese, sesepro } = Config.getGroup(e.group_id)
|
||||
if (!sese && !sesepro && !e.isMaster) {
|
||||
return e.reply(SWITCH_ERROR)
|
||||
}
|
||||
|
||||
e.reply(START_EXECUTION)
|
||||
|
||||
const api = 'https://ovooa.caonm.net/API/cosplay/api.php'
|
||||
|
||||
let res = await fetch(api).then((res) => res.json()).catch((err) => console.error(err))
|
||||
|
||||
if (!res) return e.reply(API_ERROR)
|
||||
|
||||
res = res.data
|
||||
let item = 1
|
||||
let msg = [res.Title]
|
||||
for (let i of res.data) {
|
||||
msg.push(segment.image(i))
|
||||
if (item >= 20) {
|
||||
break
|
||||
} else {
|
||||
item++
|
||||
}
|
||||
let res
|
||||
try {
|
||||
res = await fetch(api).then((res) => res.json())
|
||||
} catch (err) {
|
||||
logger.error(err)
|
||||
return e.reply(API_ERROR)
|
||||
}
|
||||
|
||||
const { Title, data } = res
|
||||
const items = _.take(data, 20).map((i) => segment.image(i))
|
||||
const msg = [Title, ...items]
|
||||
common.recallSendForwardMsg(e, msg)
|
||||
return true
|
||||
}
|
||||
|
||||
// cos/acg搜索
|
||||
|
||||
@@ -4,7 +4,7 @@ import plugin from '../../../lib/plugins/plugin.js'
|
||||
import { Config } from '../components/index.js'
|
||||
import { common, GroupAdmin as ga, puppeteer, QQApi } from '../model/index.js'
|
||||
import cronValidate from '../tools/cronValidate.js'
|
||||
import { groupTitleMsg } from '../tools/msg.js'
|
||||
import { groupTitleMsg } from '../constants/msg.js'
|
||||
// API请求错误文案
|
||||
const API_ERROR = '❎ 出错辣,请稍后重试'
|
||||
// 正则
|
||||
|
||||
@@ -3,7 +3,7 @@ import gsCfg from '../../genshin/model/gsCfg.js'
|
||||
import fs from 'node:fs'
|
||||
import common from '../../../lib/common/common.js'
|
||||
import { Data, Plugin_Path } from '../components/index.js'
|
||||
import { incomeCurve } from '../tools/nga.js'
|
||||
import { incomeCurve } from '../constants/nga.js'
|
||||
|
||||
export class NGA extends plugin {
|
||||
constructor () {
|
||||
|
||||
@@ -2,7 +2,7 @@ import plugin from '../../../lib/plugins/plugin.js'
|
||||
import { Config } from '../components/index.js'
|
||||
import { Pixiv, common, setu } from '../model/index.js'
|
||||
import { Admin } from './admin.js'
|
||||
import { ImageRPSS } from '../tools/pixiv.js'
|
||||
import { ImageRPSS } from '../constants/pixiv.js'
|
||||
// 文案
|
||||
const SWITCH_ERROR = '主人没有开放这个功能哦(*/ω\*)'
|
||||
// 汉字数字匹配正则
|
||||
|
||||
@@ -1,64 +1,7 @@
|
||||
import plugin from '../../../lib/plugins/plugin.js'
|
||||
import _ from 'lodash'
|
||||
import { puppeteer, funApi } from '../model/index.js'
|
||||
|
||||
const SEARCH_MAP = {
|
||||
|
||||
百度: 'https://www.baidu.com/s?wd=',
|
||||
|
||||
必应: 'https://cn.bing.com/search?q=',
|
||||
|
||||
谷歌: 'https://www.google.com/search?q=',
|
||||
|
||||
微博: 'https://s.weibo.com/weibo?q=',
|
||||
|
||||
淘宝: 'https://s.taobao.com/search?q=',
|
||||
|
||||
京东: 'https://search.jd.com/Search?keyword=',
|
||||
|
||||
知乎: 'https://www.zhihu.com/search?q=',
|
||||
|
||||
头条: 'https://so.toutiao.com/search?keyword=',
|
||||
|
||||
抖音: 'https://www.douyin.com/search/',
|
||||
|
||||
快手: 'https://www.kuaishou.com/search/video?searchKey=',
|
||||
|
||||
虎牙: 'https://www.huya.com/search?hsk=',
|
||||
|
||||
斗鱼: 'https://www.douyu.com/search/?kw=',
|
||||
|
||||
萌娘百科: 'https://zh.moegirl.org.cn/index.php?search=',
|
||||
|
||||
B站: 'https://search.bilibili.com/all?keyword=',
|
||||
|
||||
腾讯视频: 'https://v.qq.com/x/search/?q=',
|
||||
|
||||
优酷: 'https://so.youku.com/search_video/',
|
||||
|
||||
爱奇艺: 'https://so.iqiyi.com/so/q_',
|
||||
|
||||
芒果TV: 'https://so.mgtv.com/so?k=',
|
||||
|
||||
百度图片: 'https://image.baidu.com/search/index?tn=baiduimage&word=',
|
||||
|
||||
百度文库: 'https://wenku.baidu.com/search?word=',
|
||||
|
||||
4399: 'https://so2.4399.com/search/search.php?k=',
|
||||
|
||||
GitHub: 'https://github.com/search?q=',
|
||||
|
||||
力扣: 'https://leetcode.cn/search/?q=',
|
||||
|
||||
MDN: 'https://developer.mozilla.org/zh-CN/search?q=',
|
||||
|
||||
CSDN: 'https://so.csdn.net/so/search?q=',
|
||||
|
||||
掘金: 'https://juejin.cn/search?query=',
|
||||
|
||||
油猴: 'https://greasyfork.org/zh-CN/scripts?q='
|
||||
}
|
||||
|
||||
import { SEARCH_MAP } from '../constants/search.js'
|
||||
const searchReg = new RegExp(`^#?(${_.keys(SEARCH_MAP).join('|')})搜索(.*)`)
|
||||
|
||||
export class NewSearch extends plugin {
|
||||
|
||||
@@ -104,7 +104,7 @@ export class NewState extends plugin {
|
||||
* @return {String} 天:?时:分:秒
|
||||
*/
|
||||
function Formatting (time, repair = true) {
|
||||
let times = common.getsecond(time, repair)
|
||||
let times = common.getSecond(time, repair)
|
||||
|
||||
let { second, minute, hour, day } = times
|
||||
|
||||
|
||||
24
constants/fun.js
Normal file
24
constants/fun.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/** 点赞成功回复的图片 */
|
||||
export const successImgs = [
|
||||
'https://api.caonm.net/api/zan/z.php?qq=',
|
||||
'http://api.caonm.net/api/bix/b.php?qq=',
|
||||
'http://api.caonm.net/api/kan/kan_3.php?qq=',
|
||||
'https://api.caonm.net/api/kan/kan.php?qq='
|
||||
]
|
||||
|
||||
/** 点赞失败回复的图片 */
|
||||
export const faildsImgs = [
|
||||
'https://ovooa.caonm.net/API/pa/api.php?QQ=',
|
||||
'https://api.caonm.net/api/ti/t.php?qq=',
|
||||
'https://api.caonm.net/api/gun/index.php?qq=',
|
||||
'https://api.caonm.net/api/gund/g.php?qq='
|
||||
]
|
||||
|
||||
export const heisiType = {
|
||||
白丝: { type: 'baisi', page: 17 },
|
||||
黑丝: { type: 'heisi', page: 43 },
|
||||
巨乳: { type: 'juru', page: 8 },
|
||||
jk: { type: 'jk', page: 6 },
|
||||
网红: { type: 'mcn', page: 36 },
|
||||
美足: { type: 'meizu', page: 9 }
|
||||
}
|
||||
56
constants/search.js
Normal file
56
constants/search.js
Normal file
@@ -0,0 +1,56 @@
|
||||
export const SEARCH_MAP = {
|
||||
|
||||
百度: 'https://www.baidu.com/s?wd=',
|
||||
|
||||
必应: 'https://cn.bing.com/search?q=',
|
||||
|
||||
谷歌: 'https://www.google.com/search?q=',
|
||||
|
||||
微博: 'https://s.weibo.com/weibo?q=',
|
||||
|
||||
淘宝: 'https://s.taobao.com/search?q=',
|
||||
|
||||
京东: 'https://search.jd.com/Search?keyword=',
|
||||
|
||||
知乎: 'https://www.zhihu.com/search?q=',
|
||||
|
||||
头条: 'https://so.toutiao.com/search?keyword=',
|
||||
|
||||
抖音: 'https://www.douyin.com/search/',
|
||||
|
||||
快手: 'https://www.kuaishou.com/search/video?searchKey=',
|
||||
|
||||
虎牙: 'https://www.huya.com/search?hsk=',
|
||||
|
||||
斗鱼: 'https://www.douyu.com/search/?kw=',
|
||||
|
||||
萌娘百科: 'https://zh.moegirl.org.cn/index.php?search=',
|
||||
|
||||
B站: 'https://search.bilibili.com/all?keyword=',
|
||||
|
||||
腾讯视频: 'https://v.qq.com/x/search/?q=',
|
||||
|
||||
优酷: 'https://so.youku.com/search_video/',
|
||||
|
||||
爱奇艺: 'https://so.iqiyi.com/so/q_',
|
||||
|
||||
芒果TV: 'https://so.mgtv.com/so?k=',
|
||||
|
||||
百度图片: 'https://image.baidu.com/search/index?tn=baiduimage&word=',
|
||||
|
||||
百度文库: 'https://wenku.baidu.com/search?word=',
|
||||
|
||||
4399: 'https://so2.4399.com/search/search.php?k=',
|
||||
|
||||
GitHub: 'https://github.com/search?q=',
|
||||
|
||||
力扣: 'https://leetcode.cn/search/?q=',
|
||||
|
||||
MDN: 'https://developer.mozilla.org/zh-CN/search?q=',
|
||||
|
||||
CSDN: 'https://so.csdn.net/so/search?q=',
|
||||
|
||||
掘金: 'https://juejin.cn/search?query=',
|
||||
|
||||
油猴: 'https://greasyfork.org/zh-CN/scripts?q='
|
||||
}
|
||||
61
constants/youdao.js
Normal file
61
constants/youdao.js
Normal file
@@ -0,0 +1,61 @@
|
||||
export const langType = [{
|
||||
code: 'ar',
|
||||
label: '阿拉伯语',
|
||||
alphabet: 'A'
|
||||
}, {
|
||||
code: 'de',
|
||||
label: '德语',
|
||||
alphabet: 'D'
|
||||
}, {
|
||||
code: 'ru',
|
||||
label: '俄语',
|
||||
alphabet: 'E'
|
||||
}, {
|
||||
code: 'fr',
|
||||
label: '法语',
|
||||
alphabet: 'F'
|
||||
}, {
|
||||
code: 'ko',
|
||||
label: '韩语',
|
||||
alphabet: 'H'
|
||||
}, {
|
||||
code: 'nl',
|
||||
label: '荷兰语',
|
||||
alphabet: 'H'
|
||||
}, {
|
||||
code: 'pt',
|
||||
label: '葡萄牙语',
|
||||
alphabet: 'P'
|
||||
}, {
|
||||
code: 'ja',
|
||||
label: '日语',
|
||||
alphabet: 'R'
|
||||
}, {
|
||||
code: 'th',
|
||||
label: '泰语',
|
||||
alphabet: 'T'
|
||||
}, {
|
||||
code: 'es',
|
||||
label: '西班牙语',
|
||||
alphabet: 'X'
|
||||
}, {
|
||||
code: 'en',
|
||||
label: '英语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'it',
|
||||
label: '意大利语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'vi',
|
||||
label: '越南语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'id',
|
||||
label: '印度尼西亚语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'zh-CHS',
|
||||
label: '中文',
|
||||
alphabet: 'Z'
|
||||
}]
|
||||
@@ -64,33 +64,16 @@ export default new class newCommon {
|
||||
* @param {boolean} repair - 是否修复不足 10 的时,分,秒数
|
||||
* @returns {{day: number, hour: (string|number), minute: (string|number), second: (string|number)}} - 包含转换结果的对象
|
||||
*/
|
||||
getsecond (time, repair) {
|
||||
let second = parseInt(time)
|
||||
let minute = 0
|
||||
let hour = 0
|
||||
let day = 0
|
||||
if (second > 60) {
|
||||
minute = parseInt(second / 60)
|
||||
second = parseInt(second % 60)
|
||||
}
|
||||
if (minute > 60) {
|
||||
hour = parseInt(minute / 60)
|
||||
minute = parseInt(minute % 60)
|
||||
}
|
||||
if (hour > 23) {
|
||||
day = parseInt(hour / 24)
|
||||
hour = parseInt(hour % 24)
|
||||
}
|
||||
if (repair) {
|
||||
hour = hour < 10 ? '0' + hour : hour
|
||||
minute = minute < 10 ? '0' + minute : minute
|
||||
second = second < 10 ? '0' + second : second
|
||||
}
|
||||
getSecond (time, repair) {
|
||||
const second = parseInt(time % 60)
|
||||
const minute = parseInt((time / 60) % 60)
|
||||
const hour = parseInt((time / (60 * 60)) % 24)
|
||||
const day = parseInt(time / (24 * 60 * 60))
|
||||
return {
|
||||
day,
|
||||
hour,
|
||||
minute,
|
||||
second
|
||||
hour: repair && hour < 10 ? `0${hour}` : hour,
|
||||
minute: repair && minute < 10 ? `0${minute}` : minute,
|
||||
second: repair && second < 10 ? `0${second}` : second
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +297,7 @@ export default new class newCommon {
|
||||
|
||||
/** 默认秒转换格式 */
|
||||
getsecondformat (value) {
|
||||
let time = this.getsecond(value)
|
||||
let time = this.getSecond(value)
|
||||
|
||||
let { second, minute, hour, day } = time
|
||||
// 处理返回消息
|
||||
|
||||
@@ -3,8 +3,8 @@ import moment from 'moment'
|
||||
import fetch from 'node-fetch'
|
||||
import { Config } from '../components/index.js'
|
||||
import request from '../lib/request/request.js'
|
||||
import { rankType } from '../tools/pixiv.js'
|
||||
import { pixivMsg } from '../tools/msg.js'
|
||||
import { rankType } from '../constants/pixiv.js'
|
||||
import { pixivMsg } from '../constants/msg.js'
|
||||
import PixivApi from './Pixiv/api.js'
|
||||
/** API请求错误文案 */
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import fetch from 'node-fetch'
|
||||
import md5 from 'md5'
|
||||
import _ from 'lodash'
|
||||
import request from '../../lib/request/request.js'
|
||||
import { langType } from '../../constants/youdao.js'
|
||||
import { puppeteer } from '../index.js'
|
||||
const API_ERROR = '出了点小问题,待会再试试吧'
|
||||
export const xiurenTypeId = {
|
||||
@@ -11,75 +12,11 @@ export const xiurenTypeId = {
|
||||
}
|
||||
}
|
||||
export default new class {
|
||||
constructor () {
|
||||
this.langtype = [{
|
||||
code: 'ar',
|
||||
label: '阿拉伯语',
|
||||
alphabet: 'A'
|
||||
}, {
|
||||
code: 'de',
|
||||
label: '德语',
|
||||
alphabet: 'D'
|
||||
}, {
|
||||
code: 'ru',
|
||||
label: '俄语',
|
||||
alphabet: 'E'
|
||||
}, {
|
||||
code: 'fr',
|
||||
label: '法语',
|
||||
alphabet: 'F'
|
||||
}, {
|
||||
code: 'ko',
|
||||
label: '韩语',
|
||||
alphabet: 'H'
|
||||
}, {
|
||||
code: 'nl',
|
||||
label: '荷兰语',
|
||||
alphabet: 'H'
|
||||
}, {
|
||||
code: 'pt',
|
||||
label: '葡萄牙语',
|
||||
alphabet: 'P'
|
||||
}, {
|
||||
code: 'ja',
|
||||
label: '日语',
|
||||
alphabet: 'R'
|
||||
}, {
|
||||
code: 'th',
|
||||
label: '泰语',
|
||||
alphabet: 'T'
|
||||
}, {
|
||||
code: 'es',
|
||||
label: '西班牙语',
|
||||
alphabet: 'X'
|
||||
}, {
|
||||
code: 'en',
|
||||
label: '英语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'it',
|
||||
label: '意大利语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'vi',
|
||||
label: '越南语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'id',
|
||||
label: '印度尼西亚语',
|
||||
alphabet: 'Y'
|
||||
}, {
|
||||
code: 'zh-CHS',
|
||||
label: '中文',
|
||||
alphabet: 'Z'
|
||||
}]
|
||||
}
|
||||
|
||||
/** 有道翻译 */
|
||||
async youdao (msg, to = 'auto', from = 'auto') {
|
||||
if (to != 'auto') to = this.langtype.find(item => item.label == to)?.code
|
||||
if (from != 'auto') from = this.langtype.find(item => item.label == from)?.code
|
||||
if (!to || !from) return `未找到翻译的语种,支持的语言为:\n${this.langtype.map(item => item.label).join(',')}\n示例:#翻译你好 - 自动翻译\n#日语翻译你好 - 指定翻译为语种\n#中文-日语翻译你好 - 指定原语言翻译为指定语言`
|
||||
if (to != 'auto') to = langType.find(item => item.label == to)?.code
|
||||
if (from != 'auto') from = langType.find(item => item.label == from)?.code
|
||||
if (!to || !from) return `未找到翻译的语种,支持的语言为:\n${langType.map(item => item.label).join(',')}\n示例:#翻译你好 - 自动翻译\n#日语翻译你好 - 指定翻译为语种\n#中文-日语翻译你好 - 指定原语言翻译为指定语言`
|
||||
// 翻译结果为空的提示
|
||||
const RESULT_ERROR = '找不到翻译结果'
|
||||
// API 请求错误提示
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { common, Pixiv } from './index.js'
|
||||
import { Data, Plugin_Path, Config } from '../components/index.js'
|
||||
import _ from 'lodash'
|
||||
import { setuMsg } from '../tools/msg.js'
|
||||
import { setuMsg } from '../constants/msg.js'
|
||||
import request from '../lib/request/request.js'
|
||||
export default new class setu {
|
||||
constructor () {
|
||||
@@ -250,7 +250,7 @@ export default new class setu {
|
||||
* @return {String}
|
||||
*/
|
||||
Secondformat (value) {
|
||||
let time = common.getsecond(value)
|
||||
let time = common.getSecond(value)
|
||||
|
||||
let { second, minute, hour, day } = time
|
||||
// 处理返回消息
|
||||
|
||||
@@ -14,7 +14,7 @@ try {
|
||||
Contactable = (await import('oicq')).default
|
||||
core = (await import('oicq')).core
|
||||
} catch (error) {
|
||||
Contactable = (await import('icqq').catch(() => logger.error('未检测到icqq')))?.default
|
||||
Contactable = (await import('icqq').catch(() => {}))?.default
|
||||
core = (await import('icqq').catch(() => {}))?.core
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user