Skip to content

Commit

Permalink
✨ send face to discord, close #12
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX committed May 16, 2021
1 parent 3486ec7 commit 91ea2be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"dist"
],
"devDependencies": {
"typescript": "^4.2.2",
"koishi-adapter-discord": "^1.1.3",
"koishi-adapter-onebot": "^3.0.9",
"koishi-core": "^3.11.0"
"koishi-core": "^3.11.0",
"typescript": "^4.2.2"
},
"dependencies": {
"koishi-core": "^3.11.0",
"mysql": "^2.18.1",
"qface": "^1.1.0",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32"
},
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import {MessageRelation} from './entity/message'
import DiscordId from './entity/discordId'
import {Embed, GuildMember, Message, Role, snowflake} from "koishi-adapter-discord/lib/types";

// @ts-ignore
import {data} from 'qface'

require('dotenv').config()

interface RelayRelation {
Expand Down Expand Up @@ -298,6 +301,10 @@ const adaptOnebotMessage = async (meta: Session.Payload<"message", any>) => {
if (v.type === 'reply') {
return ''
}
if (v.type === 'face') {
let alt = data.find(face => face.QSid === v.data.id)
return alt ? `[${alt.QDes.slice(1)}]` : `[表情: ${v.data.id}]`
}
return segment.join([v]).trim()
}))).join('')
contents = contents.replace(/@everyone/g, () => '\\@everyone').replace(/@here/g, () => '\\@here')
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ process-nextick-args@~2.0.0:
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==

[email protected]:
[email protected], qface@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/qface/-/qface-1.1.0.tgz#63643ea11baf96ae40243c3b788d95ad861a3592"
integrity sha512-NQ86A5bZPUO2m/t9P1VzncwuukM/5dCeLwXO5tfEvkYeAvBrXnrQLPngPxDRITIIm+eVb9NXu+YYVca3wdGmBg==
Expand Down

0 comments on commit 91ea2be

Please sign in to comment.