koishi-plugin-bilibili-notify 1.3.0-rc.0 → 1.3.0

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.
@@ -73,116 +73,108 @@ class ComRegister {
73
73
  });
74
74
  // 从数据库获取订阅
75
75
  this.getSubFromDatabase(ctx);
76
- /* const testCom = ctx.command('test', { hidden: true, permissions: ['authority:5'] })
77
-
76
+ const testCom = ctx.command('test', { hidden: true, permissions: ['authority:5'] });
78
77
  testCom.subcommand('.cookies')
79
78
  .usage('测试指令,用于测试从数据库读取cookies')
80
79
  .action(async () => {
81
- this.logger.info('调用test cookies指令')
82
- // await ctx.ba.loadCookiesFromDatabase()
83
- console.log(JSON.parse(ctx.ba.getCookies()));
84
- })
85
-
80
+ this.logger.info('调用test cookies指令');
81
+ // await ctx.ba.loadCookiesFromDatabase()
82
+ console.log(JSON.parse(ctx.ba.getCookies()));
83
+ });
86
84
  testCom
87
85
  .subcommand('.my')
88
86
  .usage('测试指令,用于测试获取自己信息')
89
87
  .example('test.my')
90
88
  .action(async () => {
91
- const content = await ctx.ba.getMyselfInfo()
92
- console.log(content);
93
- })
94
-
89
+ const content = await ctx.ba.getMyselfInfo();
90
+ console.log(content);
91
+ });
95
92
  testCom
96
93
  .subcommand('.user <mid:string>')
97
94
  .usage('测试指令,用于测试获取用户信息')
98
95
  .example('test.user 用户UID')
99
96
  .action(async (_, mid) => {
100
- const content = await ctx.ba.getUserInfo(mid)
101
- console.log(content);
102
- })
103
-
97
+ const content = await ctx.ba.getUserInfo(mid);
98
+ console.log(content);
99
+ });
104
100
  testCom
105
101
  .subcommand('.time')
106
102
  .usage('测试时间接口')
107
103
  .example('test.time')
108
104
  .action(async ({ session }) => {
109
- session.send(await ctx.ba.getTimeNow())
110
- })
111
-
105
+ session.send(await ctx.ba.getTimeNow());
106
+ });
112
107
  testCom
113
108
  .subcommand('.gimg <uid:string> <index:number>')
114
109
  .usage('测试图片生成')
115
110
  .example('test.gimg')
116
111
  .action(async ({ session }, uid, index) => {
117
- // logger
118
- this.logger.info('调用test gimg指令')
119
- // 获取用户空间动态数据
120
- const { data } = await ctx.ba.getUserSpaceDynamic(uid)
121
- // 获取动态推送图片
122
- const { pic, buffer } = await ctx.gi.generateDynamicImg(data.items[index])
123
- // 如果pic存在,则直接返回pic
124
- if (pic) return pic
125
- // pic不存在,说明使用的是page模式
126
- await session.send(h.image(buffer, 'image/png'))
127
- })
128
-
112
+ // logger
113
+ this.logger.info('调用test gimg指令');
114
+ // 获取用户空间动态数据
115
+ const { data } = await ctx.ba.getUserSpaceDynamic(uid);
116
+ // 获取动态推送图片
117
+ const { pic, buffer } = await ctx.gi.generateDynamicImg(data.items[index]);
118
+ // 如果pic存在,则直接返回pic
119
+ if (pic)
120
+ return pic;
121
+ // pic不存在,说明使用的是page模式
122
+ await session.send(koishi_1.h.image(buffer, 'image/png'));
123
+ });
129
124
  testCom
130
125
  .subcommand('.group')
131
126
  .usage('查看session groupId')
132
127
  .example('test group')
133
128
  .action(({ session }) => {
134
- console.log(session.event.channel);
135
- })
136
-
129
+ console.log(session.event.channel);
130
+ });
137
131
  testCom
138
132
  .subcommand('.session')
139
133
  .usage('查看seesion')
140
134
  .example('test session')
141
135
  .action(({ session }) => {
142
- console.log(session);
143
- })
144
-
136
+ console.log(session);
137
+ });
145
138
  testCom
146
139
  .subcommand('.utc')
147
140
  .usage('获取当前UTC+8 Unix时间戳')
148
141
  .example('test utc')
149
142
  .action(async ({ session }) => {
150
- session.send((await ctx.ba.getServerUTCTime()).toString())
151
- })
152
-
143
+ session.send((await ctx.ba.getServerUTCTime()).toString());
144
+ });
153
145
  testCom
154
146
  .subcommand('.livestop', '发送下播提示语测试')
155
147
  .usage('发送下播提示语测试')
156
148
  .example('test livestop')
157
149
  .action(async ({ session }) => {
158
- // logger
159
- this.logger.info('调用test gimg指令')
160
- // 获取主播信息
161
- const { data } = await ctx.ba.getMasterInfo('686127')
162
- let resizedImage: Buffer
163
- try {
164
- resizedImage = await Jimp.read(data.info.face).then(async image => {
165
- return await image.resize(100, 100).getBufferAsync(Jimp.MIME_PNG)
166
- })
167
- } catch (e) {
168
- if (e.message === 'Unsupported MIME type: image/webp') console.log('主播使用的是webp格式头像,无法进行渲染');
169
- else console.log(e);
170
- }
171
- // 发送下播提示语
172
- await session.send(
173
- <>{resizedImage && h.image(resizedImage, 'image/png')} 主播{data.info.uname}已下播</>
174
- )
175
- })
176
-
150
+ // logger
151
+ this.logger.info('调用test gimg指令');
152
+ // 获取主播信息
153
+ const { data } = await ctx.ba.getMasterInfo('686127');
154
+ let resizedImage;
155
+ try {
156
+ resizedImage = await jimp_1.default.read(data.info.face).then(async (image) => {
157
+ return await image.resize(100, 100).getBufferAsync(jimp_1.default.MIME_PNG);
158
+ });
159
+ }
160
+ catch (e) {
161
+ if (e.message === 'Unsupported MIME type: image/webp')
162
+ console.log('主播使用的是webp格式头像,无法进行渲染');
163
+ else
164
+ console.log(e);
165
+ }
166
+ // 发送下播提示语
167
+ await session.send((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [resizedImage && koishi_1.h.image(resizedImage, 'image/png'), " \u4E3B\u64AD", data.info.uname, "\u5DF2\u4E0B\u64AD"] }));
168
+ });
177
169
  testCom
178
170
  .subcommand('.sendmsg', '测试发送消息方法')
179
171
  .usage('测试发送消息方法')
180
172
  .example('test sendmsg')
181
173
  .action(async ({ session }) => {
182
- // 获得对应bot
183
- const bot = this.getTheCorrespondingBotBasedOnTheSession(session)
184
- // this.sendMsg(['all'], bot, 'Hello World')
185
- }) */
174
+ // 获得对应bot
175
+ const bot = this.getTheCorrespondingBotBasedOnTheSession(session);
176
+ // this.sendMsg(['all'], bot, 'Hello World')
177
+ });
186
178
  const biliCom = ctx.command('bili', 'bili-notify插件相关指令', { permissions: ['authority:3'] });
187
179
  biliCom.subcommand('.login', '登录B站之后才可以进行之后的操作')
188
180
  .usage('使用二维码登录,登录B站之后才可以进行之后的操作')
@@ -680,6 +680,7 @@ class GenerateImg extends koishi_1.Service {
680
680
 
681
681
  .card .card-major .single-photo-item {
682
682
  max-width: 500px;
683
+ max-height: 1000px;
683
684
  border-radius: 10px;
684
685
  overflow: hidden;
685
686
  }
@@ -1009,6 +1010,7 @@ class GenerateImg extends koishi_1.Service {
1009
1010
 
1010
1011
  .card .card-major .single-photo-item {
1011
1012
  max-width: 500px;
1013
+ max-height: 1000px;
1012
1014
  border-radius: 10px;
1013
1015
  overflow: hidden;
1014
1016
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "1.3.0-rc.0",
4
+ "version": "1.3.0",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -163,6 +163,7 @@
163
163
  - ver 1.3.0-alpha.0 对直播推送逻辑进行小型重构,优化了性能。新增功能:定时推送直播卡片可选是否发送直播链接;在遇到getMasterInfo()错误时,可切换获取主播信息Api
164
164
  - ver 1.3.0-alpha.1 修复bug:发送直播开播通知时,如果在开播语中加入链接,同时开启了推送直播卡片发送直播链接,则会发送两条链接
165
165
  - ver 1.3.0-rc.0 修复bug:发送直播开播通知时,如果开启了开播发送链接,会在链接末尾添加一个false
166
+ - ver 1.3.0 修复bug:渲染动态时,过长的单图会导致渲染错误
166
167
 
167
168
  ## 交流群
168
169