-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(discord): support webhook message #75
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #75 +/- ##
=======================================
Coverage 82.14% 82.14%
=======================================
Files 1 1
Lines 420 420
Branches 86 86
=======================================
Hits 345 345
Misses 75 75 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
<message forward>
<message id="114514">
<author
nickname={"_custom_ nickname"}
avatar={
"https://s.gravatar.com/avatar/1dc454fa994913deea45584c0ea74084.png"
}
/>
<image url="https://koishi.chat/logo.png" />
我是<b>笨蛋</b> **你是笨蛋**
</message>
<message id="7355608">
<author avatar={"https://koishi.chat/logo.png"} />
消息
</message>
<message>
<quote id={session.messageId}></quote>
<image url="https://s.gravatar.com/avatar/1dc454fa994913deea45584c0ea74084.png" />
quote 到原 channel, 带图片 quote
</message>
<message>
<quote id="114514" />
<author nickname={"aaaa"} />
quote 到原 channel 的第一条
</message>
<message>
<author nickname={"bbbb"} />
<at id={session.userId} />
<quote id="7355608" />
quote 到内子区
@everyone
</message>
<message>没 author 的普通消息</message>
</message> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有没有什么改动总结(
草,怎么还有个 conflict |
satori/adapters/discord/src/utils.ts Lines 161 to 163 in 93263d8
不加这里的话,如果发一条链接,discord 会抓取预览信息,加到 embed,然后发一个 payload 和 channel message{
id: '1083765668144500856',
embeds: [
{
url: 'https://google.com/?123',
type: 'link',
title: 'Google',
description: "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
}
],
channel_id: '816619123890716694',
guild_id: '814065827053043743'
} {
id: '1083765668144500856',
type: 0,
content: 'https://google.com/?123',
channel_id: '816619123890716694',
author: {
url: 'https://google.com/?123',
title: 'Google',
description: "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for."
}
],
mentions: [],
mention_roles: [],
pinned: false,
mention_everyone: false,
tts: false,
timestamp: '2023-03-10T14:57:50.678000+00:00',
edited_timestamp: null,
flags: 0,
components: [],
application_id: '814066234282475520',
webhook_id: '1083763306390638693'
} |
不知道作为 adapter 要不要处理掉,上面 MESSAGE_CREATE 是允许单独出现 embeds 的,先删了看看( |
adapters/discord/src/bot.ts
Outdated
if (this.webhookLock[channelId]) return this.webhookLock[channelId] | ||
return this.webhookLock[channelId] = this._ensureWebhook(channelId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (this.webhookLock[channelId]) return this.webhookLock[channelId] | |
return this.webhookLock[channelId] = this._ensureWebhook(channelId) | |
return this.webhookLock[channelId] ||= this._ensureWebhook(channelId) |
adapters/discord/src/message.ts
Outdated
} catch (e) { | ||
if (Quester.isAxiosError(e) && e.response?.data.code === 10015) { | ||
logger.debug('webhook has been deleted, recreating..., %o, lock %o', e.response.data, this.bot.webhookLock[this.channelId]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你给 lock 打印了个 promise。
logger.debug('webhook has been deleted, recreating..., %o, lock %o', e.response.data, this.bot.webhookLock[this.channelId]) | |
logger.debug('webhook has been deleted, recreating..., %o', e.response.data) |
上面修完合一下主分支跑下 lint 就差不多了。 |
No description provided.