koishi-plugin-nitter 0.0.9 → 0.0.10
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/lib/index.js +11 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -156,6 +156,7 @@ __name(addTranslate, "addTranslate");
|
|
|
156
156
|
|
|
157
157
|
// src/index.tsx
|
|
158
158
|
var import_rettiwt_api = require("rettiwt-api");
|
|
159
|
+
var import_node_cron = require("node-cron");
|
|
159
160
|
|
|
160
161
|
// src/download.ts
|
|
161
162
|
var import_fluent_ffmpeg = __toESM(require("fluent-ffmpeg"));
|
|
@@ -311,6 +312,11 @@ function apply(ctx, config) {
|
|
|
311
312
|
};
|
|
312
313
|
}));
|
|
313
314
|
queue.onProcess(broadcast);
|
|
315
|
+
cronJob = (0, import_node_cron.schedule)(config.cronString, checkForUpdates);
|
|
316
|
+
ctx.on("dispose", () => {
|
|
317
|
+
cronJob.stop();
|
|
318
|
+
});
|
|
319
|
+
ctx.logger("nitter").info("开始监听推特动态");
|
|
314
320
|
})();
|
|
315
321
|
ctx.command("nitter.follow", "按照subscription中的订阅配置,使用登录的推特账号关注所有需要订阅的账号", { authority: 3 }).action(async () => {
|
|
316
322
|
const whiteList = ctx.subscription.getAvailableAccounts(config.app);
|
|
@@ -365,7 +371,11 @@ function apply(ctx, config) {
|
|
|
365
371
|
const [screenshot, imageUrls, hlsUrls] = await renderTweetScreenshot(tweetId);
|
|
366
372
|
const screenshotMsg = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: "data:image/png;base64," + screenshot.toString("base64") });
|
|
367
373
|
await ctx.subscription.broadcast(config.app, account, screenshotMsg);
|
|
368
|
-
let forwardMsg = [
|
|
374
|
+
let forwardMsg = [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("message", { children: [
|
|
375
|
+
ctx.subscription.getName(config.app, account),
|
|
376
|
+
" ",
|
|
377
|
+
ctx.subscription.getAccount(config.app, account)
|
|
378
|
+
] })];
|
|
369
379
|
const videoUrls = await downloadVideosToBase64(hlsUrls, config.maxSize);
|
|
370
380
|
if (imageUrls.length > 0) {
|
|
371
381
|
forwardMsg.push(...imageUrls.map((url) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("message", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: url }) })));
|