@alemonjs/qq-bot 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/register.js +8 -9
  2. package/package.json +1 -1
package/lib/register.js CHANGED
@@ -180,17 +180,16 @@ const register = (client) => {
180
180
  });
181
181
  const getMessageContent = event => {
182
182
  let msg = event?.content ?? '';
183
- const atUsers = [];
184
- if (event.mentions) {
183
+ if (event?.mentions) {
185
184
  for (const item of event.mentions) {
186
- atUsers.push({
187
- id: item.id
188
- });
185
+ if (!item.id) {
186
+ msg = msg.replace(`<@!${item.id}>`, '').trim();
187
+ msg = msg.replace(`<@${item.id}>`, '').trim();
188
+ }
189
+ if (item?.username) {
190
+ msg = msg.replace(`[${item.username}]`, '').trim();
191
+ }
189
192
  }
190
- atUsers.forEach(item => {
191
- msg = msg.replace(`<@!${item.id}>`, '').trim();
192
- msg = msg.replace(`<@${item.id}>`, '').trim();
193
- });
194
193
  }
195
194
  return msg;
196
195
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.24",
3
+ "version": "2.1.25",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",