Skip to content

Commit

Permalink
✨ sticker
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX committed Jul 26, 2022
1 parent 8f97f20 commit 14472b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koishi-plugin-dcqq-relay",
"version": "0.4.0-alpha.0",
"version": "0.4.0",
"main": "dist/index.js",
"description": "Synchronize messages between discord and qq",
"repository": "https://github.com/koishijs/koishi-plugin-dcqq-relay",
Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const Config: Schema<Config> = Schema.object({
}))
})
export const using = ['database'] as const
new Logger('mysql').level = 3

export async function apply(ctx: Context, config: Config) {
ctx.model.extend(TableName, {
Expand Down Expand Up @@ -177,6 +176,9 @@ export async function apply(ctx: Context, config: Config) {
})
return rtn
}) + contents
if(msg.sticker_items){
contents += msg.sticker_items.map(v => segment('image', {url: `https://cdn.discordapp.com/stickers/${v.id}.png`})).join('')
}

let quotePrefix = ""
if (meta.quote) {
Expand All @@ -196,7 +198,7 @@ export async function apply(ctx: Context, config: Config) {
return `${quotePrefix}${username}:\n${contents}`
}

const relation = config.relations.find(v => v.onebotChannel === meta.channelId || v.discordChannel === meta.channelId)
const relation = config.relations.find(v => v.discordChannel === meta.channelId)
await meta.preprocess()
const onebot = meta.app.bots.find(v => v.platform === 'onebot') as unknown as OneBotBot
const msg = await adaptMessage()
Expand All @@ -209,7 +211,7 @@ export async function apply(ctx: Context, config: Config) {
})

validCtx.platform('onebot').on('message', async (meta) => {
const relation = config.relations.find(v => v.onebotChannel === meta.channelId || v.discordChannel === meta.channelId)
const relation = config.relations.find(v => v.onebotChannel === meta.channelId)
const dcBot = meta.app.bots.find(v => v.platform === 'discord') as unknown as DiscordBot

const adaptOnebotMessage = async () => {
Expand Down

0 comments on commit 14472b8

Please sign in to comment.