Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
28 lines
692 B
Plaintext
28 lines
692 B
Plaintext
const data = require('./data.json')
|
|
|
|
function get(id) {
|
|
id = String(id)
|
|
return data.find((el) => el.QSid === id)
|
|
}
|
|
|
|
function getByText(input) {
|
|
if (input[0] === '/') input = input.substring(1)
|
|
const match = data.find((el) => el.QDes.substring(1) === input)
|
|
|| data.find((el) => el.Input.includes(input))
|
|
|| data.find((el) => el.Input.some((i) => i.startsWith(input)))
|
|
return match ? match.QSid : null
|
|
}
|
|
|
|
function getUrl(id, base = 'https://koishi.js.org/QFace') {
|
|
const item = get(id)
|
|
if (!item) return ''
|
|
return base + (item.isStatic ? `/static/s${id}.png` : `/gif/s${id}.gif`)
|
|
}
|
|
|
|
module.exports = {
|
|
data,
|
|
get,
|
|
getUrl,
|
|
getByText,
|
|
}
|