@alemonjs/qq-bot 2.1.15 → 2.1.17

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.
package/README.md CHANGED
@@ -18,8 +18,6 @@ yarn add @alemonjs/qq-bot
18
18
  qq-bot:
19
19
  # 编号
20
20
  app_id: ''
21
- # 令牌
22
- token: ''
23
21
  # 密钥
24
22
  secret: ''
25
23
  ```
@@ -2,6 +2,7 @@ export type C2C_MESSAGE_CREATE_TYPE = {
2
2
  author: {
3
3
  id: string;
4
4
  user_openid: string;
5
+ username: string;
5
6
  };
6
7
  content: string;
7
8
  id: string;
@@ -2,6 +2,7 @@ export interface GROUP_AT_MESSAGE_CREATE_TYPE {
2
2
  author: {
3
3
  id: string;
4
4
  member_openid: string;
5
+ username: string;
5
6
  };
6
7
  content: string;
7
8
  group_openid: string;
package/lib/register.js CHANGED
@@ -49,7 +49,14 @@ const register = (client) => {
49
49
  .addPlatform({ Platform: platform, value: event, BotId: botId })
50
50
  .addGuild({ GuildId: event.group_id, SpaceId: `GROUP:${event.group_id}` })
51
51
  .addChannel({ ChannelId: event.group_id })
52
- .addUser({ UserId: event.author.id, UserKey, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
52
+ .addUser({
53
+ UserId: event.author.id,
54
+ UserKey,
55
+ UserAvatar: UserAvatar,
56
+ UserName: event?.author?.username,
57
+ IsMaster: isMaster,
58
+ IsBot: false
59
+ })
53
60
  .addMessage({ MessageId: event.id })
54
61
  .addText({ MessageText: event.content?.trim() })
55
62
  .addOpen({ OpenId: `C2C:${event.author.member_openid}` })
@@ -61,7 +68,14 @@ const register = (client) => {
61
68
  const UserAvatar = createUserAvatarURL(event.author.id);
62
69
  cbp.send(FormatEvent.create('private.message.create')
63
70
  .addPlatform({ Platform: platform, value: event, BotId: botId })
64
- .addUser({ UserId: event.author.id, UserKey, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
71
+ .addUser({
72
+ UserId: event.author.id,
73
+ UserKey,
74
+ UserAvatar: UserAvatar,
75
+ UserName: event?.author?.username,
76
+ IsMaster: isMaster,
77
+ IsBot: false
78
+ })
65
79
  .addMessage({ MessageId: event.id })
66
80
  .addText({ MessageText: event.content?.trim() })
67
81
  .addOpen({ OpenId: `C2C:${event.author.user_openid}` })
@@ -168,7 +182,13 @@ const register = (client) => {
168
182
  .addPlatform({ Platform: platform, value: event, BotId: botId })
169
183
  .addGuild({ GuildId: event.group_openid, SpaceId: `GROUP:${event.group_openid}` })
170
184
  .addChannel({ ChannelId: event.group_openid })
171
- .addUser({ UserId: event.group_member_openid, UserKey, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
185
+ .addUser({
186
+ UserId: event.group_member_openid,
187
+ UserKey,
188
+ UserAvatar: UserAvatar,
189
+ IsMaster: isMaster,
190
+ IsBot: false
191
+ })
172
192
  .addMessage({ MessageId: `INTERACTION_CREATE:${event.id}` })
173
193
  .addText({ MessageText: MessageText })
174
194
  .addOpen({ OpenId: `C2C:${event.group_member_openid}` })
@@ -182,7 +202,13 @@ const register = (client) => {
182
202
  const MessageText = event.data.resolved.button_data?.trim() || '';
183
203
  const e = FormatEvent.create('private.interaction.create')
184
204
  .addPlatform({ Platform: platform, value: event, BotId: botId })
185
- .addUser({ UserId: event.user_openid, UserKey, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
205
+ .addUser({
206
+ UserId: event.user_openid,
207
+ UserKey,
208
+ UserAvatar: UserAvatar,
209
+ IsMaster: isMaster,
210
+ IsBot: false
211
+ })
186
212
  .addMessage({ MessageId: event.id })
187
213
  .addText({ MessageText: MessageText })
188
214
  .addOpen({ OpenId: `C2C:${event.user_openid}` })
@@ -57,7 +57,6 @@ export interface ApiRequestData {
57
57
  }
58
58
  export interface Options {
59
59
  app_id: string;
60
- token: string;
61
60
  secret: string;
62
61
  shard?: number[];
63
62
  intents?: IntentsEnum[];
package/lib/sends.js CHANGED
@@ -22,11 +22,15 @@ const createButtonsData = (rows, startId = 0) => {
22
22
  render_data: {
23
23
  label: value,
24
24
  visited_label: value,
25
- style: 0
25
+ style: options.style !== 'blue' ? 0 : 1
26
26
  },
27
27
  action: {
28
28
  type: typeMap[typing],
29
- permission: { type: 2 },
29
+ permission: {
30
+ type: typeof options.permission?.type === 'undefined' ? 2 : options.permission.type,
31
+ specify_user_ids: options.permission.userIds,
32
+ specify_role_ids: options.permission.roleIds
33
+ },
30
34
  unsupport_tips: options?.toolTip ?? '',
31
35
  data: options?.data ?? '',
32
36
  at_bot_show_channel_list: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",