koishi-plugin-noah 1.1.30 → 1.2.1

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/index.cjs +380 -62
  2. package/package.json +72 -71
package/lib/index.cjs CHANGED
@@ -1211,11 +1211,11 @@ function maintain(ctx, config) {
1211
1211
  let card2 = "";
1212
1212
  let text = "";
1213
1213
  if (options.stop) {
1214
- session.send(".stop");
1214
+ session.send(session.text(".stop"));
1215
1215
  card2 = config.guildNameCards[0];
1216
1216
  text = ".success-stop";
1217
1217
  } else {
1218
- session.send(".start");
1218
+ session.send(session.text(".start"));
1219
1219
  card2 = "Noah | 🚧维护中";
1220
1220
  text = ".success-start";
1221
1221
  }
@@ -1707,28 +1707,26 @@ function guildRequest(ctx, config) {
1707
1707
  __name(guildRequest, "guildRequest");
1708
1708
  function guildNameCard(ctx, config) {
1709
1709
  let currentNameCardIndex = 0;
1710
- const timerIds = /* @__PURE__ */ new Map();
1710
+ const timerDisposers = /* @__PURE__ */ new Map();
1711
1711
  async function updateBotNameCards(bot) {
1712
1712
  if (!config.guildNameCards || config.guildNameCards.length === 0) {
1713
1713
  config.guildNameCards = [config.guildNameCards[0]];
1714
1714
  }
1715
- const guilds = await bot.internal.getGroupList();
1716
- for (const guild of guilds) {
1715
+ const guilds = bot.getGuildIter();
1716
+ for await (const guild of guilds) {
1717
1717
  try {
1718
- if (guild.group_id != "649799932") continue;
1719
1718
  const nameCard = config.guildNameCards[currentNameCardIndex];
1720
- const memberInfo = await bot.internal.getGroupMemberInfo(
1721
- guild.group_id,
1722
- bot.selfId,
1723
- true
1719
+ const memberInfo = await bot.getGuildMember(guild.id, bot.selfId);
1720
+ if (memberInfo.nick === nameCard) continue;
1721
+ if (memberInfo.nick === "Noah | 🚧维护中") continue;
1722
+ await bot.internal.setGroupCard(guild.id, bot.selfId, nameCard);
1723
+ ctx.logger("guild-namecard").info(
1724
+ `更新 ${bot.selfId} 在 ${guild.name} 的群名片为 ${nameCard}`
1724
1725
  );
1725
- if (memberInfo.card === nameCard) continue;
1726
- if (memberInfo.card === "Noah | 🚧维护中") continue;
1727
- await bot.internal.setGroupCard(guild.group_id, bot.selfId, nameCard);
1728
- await new Promise((resolve3) => setTimeout(resolve3, 1e3));
1726
+ await ctx.sleep(1e3);
1729
1727
  } catch (error) {
1730
1728
  ctx.logger("guild-namecard").warn(
1731
- `Failed to update namecard in guild ${guild.id}: ${error}`
1729
+ `更新 ${bot.selfId} ${guild.name} 的群名片失败: ${error}`
1732
1730
  );
1733
1731
  }
1734
1732
  }
@@ -1736,21 +1734,20 @@ function guildNameCard(ctx, config) {
1736
1734
  }
1737
1735
  __name(updateBotNameCards, "updateBotNameCards");
1738
1736
  async function setupTimersForBot(bot) {
1739
- const existingTimers = timerIds.get(bot.selfId);
1740
- if (existingTimers) {
1741
- clearInterval(existingTimers.interval);
1737
+ const disposer = timerDisposers.get(bot.selfId);
1738
+ if (disposer) {
1739
+ disposer();
1742
1740
  }
1743
1741
  await updateBotNameCards(bot);
1744
- const interval = setInterval(
1742
+ const dispose = ctx.setInterval(
1745
1743
  () => {
1746
- ctx.logger("guild-namecard").info(`开始更新 ${bot.selfId} 的群名片...`);
1747
1744
  updateBotNameCards(bot).catch((err) => {
1748
1745
  ctx.logger("guild-namecard").warn("定时器更新群名片出错", err);
1749
1746
  });
1750
1747
  },
1751
1748
  3 * 60 * 60 * 1e3
1752
1749
  );
1753
- timerIds.set(bot.selfId, { interval });
1750
+ timerDisposers.set(bot.selfId, dispose);
1754
1751
  }
1755
1752
  __name(setupTimersForBot, "setupTimersForBot");
1756
1753
  ctx.on("ready", () => {
@@ -1768,10 +1765,10 @@ function guildNameCard(ctx, config) {
1768
1765
  });
1769
1766
  ctx.on("login-removed", (session) => {
1770
1767
  const bot = session.bot;
1771
- const timers = timerIds.get(bot.selfId);
1772
- if (timers) {
1773
- clearInterval(timers.interval);
1774
- timerIds.delete(bot.selfId);
1768
+ const disposer = timerDisposers.get(bot.selfId);
1769
+ if (disposer) {
1770
+ disposer();
1771
+ timerDisposers.delete(bot.selfId);
1775
1772
  }
1776
1773
  });
1777
1774
  }
@@ -1960,6 +1957,7 @@ var IIDXDrawer = class extends BaseDrawer {
1960
1957
 
1961
1958
  // src/drawer/sdvx/index.ts
1962
1959
  var fs2 = __toESM(require("fs"), 1);
1960
+ var import_bwip_js = __toESM(require("bwip-js"), 1);
1963
1961
  var SDVXDrawer = class extends BaseDrawer {
1964
1962
  constructor(ctx) {
1965
1963
  super(ctx);
@@ -1980,13 +1978,233 @@ var SDVXDrawer = class extends BaseDrawer {
1980
1978
  if (!compression) {
1981
1979
  compression = { lossless: true };
1982
1980
  }
1983
- const bgImage = await loadImage(getAssetPath(this.ctx, "sdvx/vf/main_bg.png"));
1981
+ const notoSansPath = getAssetPath(this.ctx, "fonts/NotoSans-VariableFont_wdth,wght.ttf");
1982
+ const notoSansJPPath = getAssetPath(this.ctx, "fonts/NotoSansJP-VariableFont_wght.ttf");
1983
+ if (fs2.existsSync(notoSansPath)) {
1984
+ FontLibrary.use("Noto Sans", notoSansPath);
1985
+ this.ctx.logger("SDVX-Drawer").debug("Loaded Noto Sans font successfully");
1986
+ } else {
1987
+ this.ctx.logger("SDVX-Drawer").warn(`Noto Sans font file not found at: ${notoSansPath}`);
1988
+ }
1989
+ if (fs2.existsSync(notoSansJPPath)) {
1990
+ FontLibrary.use("Noto Sans JP", notoSansJPPath);
1991
+ this.ctx.logger("SDVX-Drawer").debug("Loaded Noto Sans JP font successfully");
1992
+ } else {
1993
+ this.ctx.logger("SDVX-Drawer").warn(`Noto Sans JP font file not found at: ${notoSansJPPath}`);
1994
+ }
1995
+ const bgImage = await loadImage(getAssetPath(this.ctx, "sdvx/recent/main_bg.png"));
1996
+ const ticketBgImage = await loadImage(getAssetPath(this.ctx, "sdvx/recent/ticket_bg.png"));
1997
+ const gradeImages = {};
1998
+ const gradeList = ["C", "D", "S", "B", "AAA", "AAA+", "AA+", "A", "A+", "AA"];
1999
+ for (const grade of gradeList) {
2000
+ try {
2001
+ const gradePath = getAssetPath(this.ctx, `sdvx/recent/grade/Type=${grade}.png`);
2002
+ gradeImages[grade] = await loadImage(gradePath);
2003
+ } catch (error) {
2004
+ this.ctx.logger("SDVX-Drawer").warn(`Failed to load grade image for ${grade}: ${error.message}`);
2005
+ }
2006
+ }
2007
+ const playTypeImages = {};
2008
+ const playTypeList = ["UC", "PLAYED", "SPUC", "PUC", "NOPLAY", "NC", "MC", "HC"];
2009
+ for (const type of playTypeList) {
2010
+ try {
2011
+ const typePath = getAssetPath(this.ctx, `sdvx/recent/play_type/Type=${type}.png`);
2012
+ playTypeImages[type] = await loadImage(typePath);
2013
+ } catch (error) {
2014
+ this.ctx.logger("SDVX-Drawer").warn(`Failed to load play_type image for ${type}: ${error.message}`);
2015
+ }
2016
+ }
2017
+ let jacketImage;
2018
+ try {
2019
+ if (options.score.difficulty_data?.cover_url) {
2020
+ const coverUrl = `${options.config.sdvx_data_url}${options.score.difficulty_data.cover_url}`.replace(
2021
+ ".webp",
2022
+ ".png"
2023
+ );
2024
+ jacketImage = await loadImage(coverUrl);
2025
+ }
2026
+ } catch (error) {
2027
+ this.ctx.logger("SDVX-Drawer").warn(`Failed to load jacket image: ${error.message}`);
2028
+ }
1984
2029
  const canvas = new Canvas(bgImage.width, bgImage.height);
1985
2030
  const ctx = canvas.getContext("2d");
1986
2031
  ctx.imageSmoothingEnabled = true;
1987
2032
  ctx.imageSmoothingQuality = "high";
1988
2033
  ctx.clearRect(0, 0, canvas.width, canvas.height);
1989
2034
  ctx.drawImage(bgImage, 0, 0);
2035
+ ctx.save();
2036
+ ctx.translate(556, 17);
2037
+ ctx.beginPath();
2038
+ const r = 16, w = 100, h6 = 200, x0 = 0, y0 = 0;
2039
+ ctx.moveTo(x0 + r, y0);
2040
+ ctx.lineTo(x0 + w - r, y0);
2041
+ ctx.arcTo(x0 + w, y0, x0 + w, y0 + r, r);
2042
+ ctx.lineTo(x0 + w, y0 + h6 - r);
2043
+ ctx.arcTo(x0 + w, y0 + h6, x0 + w - r, y0 + h6, r);
2044
+ ctx.lineTo(x0 + r, y0 + h6);
2045
+ ctx.arcTo(x0, y0 + h6, x0, y0 + h6 - r, r);
2046
+ ctx.lineTo(x0, y0 + r);
2047
+ ctx.arcTo(x0, y0, x0 + r, y0, r);
2048
+ ctx.closePath();
2049
+ const circleRadius = 14;
2050
+ const circleX = x0 + w;
2051
+ const circleY = y0 + h6 / 2;
2052
+ ctx.moveTo(circleX + circleRadius, circleY);
2053
+ ctx.arc(circleX, circleY, circleRadius, 0, Math.PI * 2, true);
2054
+ ctx.clip();
2055
+ ctx.drawImage(jacketImage, -100, 0, 200, 200);
2056
+ ctx.restore();
2057
+ ctx.drawImage(ticketBgImage, 0, 0);
2058
+ let mainTitle = "";
2059
+ let subTitle = "";
2060
+ if (options.score.music_data) {
2061
+ if (options.score.music_data.main_title_name) {
2062
+ mainTitle = options.score.music_data.main_title_name;
2063
+ } else if (options.score.music_data.title_name) {
2064
+ mainTitle = options.score.music_data.title_name;
2065
+ }
2066
+ if (options.score.music_data.sub_title_name) {
2067
+ subTitle = options.score.music_data.sub_title_name;
2068
+ }
2069
+ }
2070
+ ctx.font = 'bold 24px "Noto Sans JP"';
2071
+ ctx.textBaseline = "alphabetic";
2072
+ ctx.textAlign = "left";
2073
+ ctx.fillStyle = "#0230A5";
2074
+ const maxWidth = 360;
2075
+ let displayMainTitle = mainTitle;
2076
+ let displaySubTitle = subTitle;
2077
+ const gap = 8;
2078
+ let mainTitleWidth = ctx.measureText(displayMainTitle).width;
2079
+ let subTitleWidth = displaySubTitle ? ctx.measureText(displaySubTitle).width : 0;
2080
+ if (mainTitleWidth + (displaySubTitle ? gap + subTitleWidth : 0) > maxWidth) {
2081
+ if (displaySubTitle) {
2082
+ let fitLength = 0;
2083
+ for (let i = 1; i <= displaySubTitle.length; i++) {
2084
+ if (ctx.measureText(displaySubTitle.substring(0, i)).width + mainTitleWidth + gap > maxWidth) {
2085
+ fitLength = i - 1;
2086
+ break;
2087
+ }
2088
+ }
2089
+ if (fitLength > 0) {
2090
+ displaySubTitle = displaySubTitle.substring(0, fitLength);
2091
+ } else {
2092
+ displaySubTitle = "";
2093
+ }
2094
+ subTitleWidth = ctx.measureText(displaySubTitle).width;
2095
+ }
2096
+ if (mainTitleWidth + (displaySubTitle ? gap + subTitleWidth : 0) > maxWidth) {
2097
+ let fitLength = 0;
2098
+ for (let i = 1; i <= displayMainTitle.length; i++) {
2099
+ if (ctx.measureText(displayMainTitle.substring(0, i)).width + (displaySubTitle ? gap + subTitleWidth : 0) > maxWidth) {
2100
+ fitLength = i - 1;
2101
+ break;
2102
+ }
2103
+ }
2104
+ if (fitLength > 0) {
2105
+ displayMainTitle = displayMainTitle.substring(0, fitLength);
2106
+ } else {
2107
+ displayMainTitle = "";
2108
+ }
2109
+ mainTitleWidth = ctx.measureText(displayMainTitle).width;
2110
+ }
2111
+ }
2112
+ ctx.fillStyle = "#0230A5";
2113
+ ctx.globalAlpha = 1;
2114
+ ctx.fillText(displayMainTitle, 147, 55);
2115
+ if (displaySubTitle) {
2116
+ ctx.fillStyle = "#0230A5";
2117
+ ctx.globalAlpha = 0.8;
2118
+ ctx.fillText(displaySubTitle, 147 + mainTitleWidth + gap, 55);
2119
+ ctx.globalAlpha = 1;
2120
+ }
2121
+ const scoreStr = options.score.music.score.toString();
2122
+ const mainPart = scoreStr.slice(0, scoreStr.length - 4);
2123
+ const lastPart = scoreStr.slice(-4);
2124
+ ctx.fillStyle = "#0230A5";
2125
+ ctx.textBaseline = "alphabetic";
2126
+ ctx.textAlign = "left";
2127
+ ctx.font = '600 48px "Noto Sans JP"';
2128
+ const x = 154;
2129
+ ctx.fillText(mainPart, x, 121);
2130
+ const mainPartWidth = ctx.measureText(mainPart).width;
2131
+ ctx.font = '600 32px "Noto Sans JP"';
2132
+ ctx.fillText(lastPart, x + mainPartWidth, 121);
2133
+ const totalScoreWidth = mainPartWidth + ctx.measureText(lastPart).width;
2134
+ ctx.fillStyle = "#0230A5";
2135
+ ctx.fillRect(x + totalScoreWidth + 8, 121 - 4, 16, 4);
2136
+ const volforceStr = options.score.extra.volforce.toFixed(2);
2137
+ ctx.fillStyle = "#0230A5";
2138
+ ctx.textBaseline = "alphabetic";
2139
+ ctx.textAlign = "right";
2140
+ ctx.font = '600 14px "Noto Sans JP"';
2141
+ ctx.fillText(volforceStr, 539, 118);
2142
+ const exscoreStr = options.score.music.exscore === 0 ? "-" : (options.score.music.exscore / options.score.difficulty_data.max_exscore * 100).toFixed(1) + "%";
2143
+ ctx.fillStyle = "#0230A5";
2144
+ ctx.textBaseline = "alphabetic";
2145
+ ctx.textAlign = "center";
2146
+ ctx.font = '600 14px "Noto Sans JP"';
2147
+ ctx.fillText(exscoreStr, 339, 195);
2148
+ const maxStr = options.score.difficulty_data.max_exscore - options.score.music.exscore === 0 ? "-" : (options.score.difficulty_data.max_exscore - options.score.music.exscore).toString();
2149
+ ctx.fillStyle = "#0230A5";
2150
+ ctx.textBaseline = "alphabetic";
2151
+ ctx.textAlign = "center";
2152
+ ctx.font = '600 14px "Noto Sans JP"';
2153
+ ctx.fillText(maxStr, 409, 195);
2154
+ const gradeImage = gradeImages[options.score.music.score_grade];
2155
+ ctx.drawImage(gradeImage, 139, 151);
2156
+ const playTypeImage = playTypeImages[options.score.music.clear_type];
2157
+ ctx.drawImage(playTypeImage, 139, 178);
2158
+ const levelStr = options.score.music.music_diff.toString();
2159
+ ctx.fillStyle = "#0230A5";
2160
+ ctx.textBaseline = "alphabetic";
2161
+ ctx.textAlign = "left";
2162
+ ctx.font = 'bold 20px "Noto Sans JP"';
2163
+ ctx.save();
2164
+ ctx.translate(86, 201);
2165
+ ctx.rotate(-Math.PI / 2);
2166
+ ctx.fillText(levelStr, 0, 0);
2167
+ ctx.restore();
2168
+ const difficultyStr = options.score.music.music_diff_name;
2169
+ ctx.fillStyle = "#0230A5";
2170
+ ctx.textBaseline = "alphabetic";
2171
+ ctx.textAlign = "right";
2172
+ ctx.font = 'bold 16px "Noto Sans JP"';
2173
+ ctx.save();
2174
+ ctx.translate(86, 32);
2175
+ ctx.rotate(-Math.PI / 2);
2176
+ ctx.fillText(difficultyStr, 0, 0);
2177
+ ctx.restore();
2178
+ const barcodeStr = options.score.music.music_id.toString() + difficultyStr;
2179
+ const barcodePng = await new Promise((resolve3, reject) => {
2180
+ import_bwip_js.default.toBuffer(
2181
+ {
2182
+ bcid: "code128",
2183
+ text: barcodeStr,
2184
+ scale: 1,
2185
+ width: 168,
2186
+ height: 28,
2187
+ includetext: false,
2188
+ backgroundcolor: "F4F4F4",
2189
+ paddingwidth: 0,
2190
+ paddingheight: 0,
2191
+ barcolor: "0230A5"
2192
+ },
2193
+ (err, png) => {
2194
+ if (err) {
2195
+ reject(err);
2196
+ } else {
2197
+ resolve3(png);
2198
+ }
2199
+ }
2200
+ );
2201
+ });
2202
+ const barcodeImage = await loadImage(barcodePng);
2203
+ ctx.save();
2204
+ ctx.translate(32, 200);
2205
+ ctx.rotate(-Math.PI / 2);
2206
+ ctx.drawImage(barcodeImage, 0, 0, 168, 28);
2207
+ ctx.restore();
1990
2208
  return this.compressImage(canvas, compression);
1991
2209
  }
1992
2210
  /**
@@ -2686,7 +2904,7 @@ __export(sdvx_exports, {
2686
2904
  logger: () => logger3,
2687
2905
  name: () => name12
2688
2906
  });
2689
- var import_koishi10 = require("koishi");
2907
+ var import_koishi11 = require("koishi");
2690
2908
 
2691
2909
  // src/games/sdvx/command.ts
2692
2910
  var command_exports2 = {};
@@ -2695,7 +2913,7 @@ __export(command_exports2, {
2695
2913
  name: () => name9
2696
2914
  });
2697
2915
 
2698
- // src/games/sdvx/commands/vf.ts
2916
+ // src/games/sdvx/commands/recent.ts
2699
2917
  var import_koishi9 = require("koishi");
2700
2918
 
2701
2919
  // src/servers/index.ts
@@ -3424,6 +3642,105 @@ function apply8(ctx, config) {
3424
3642
  }
3425
3643
  __name(apply8, "apply");
3426
3644
 
3645
+ // src/games/sdvx/commands/recent.ts
3646
+ function recent(ctx, config) {
3647
+ ctx.command("sdvx.recent [count:number]").alias("sdvx.r").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").action(async ({ session, options }, count) => {
3648
+ const atGuild = session.guildId != null;
3649
+ if (!count) count = 1;
3650
+ const cardService = new CardService(ctx);
3651
+ const serverService = new ServerService(ctx);
3652
+ const userCards = await cardService.getCardsByUid(session.user.id);
3653
+ if (userCards.length === 0) return session.text(".card-not-found");
3654
+ const userRes = await serverService.getServersByUid(session.user.id);
3655
+ const channelRes = atGuild ? await serverService.getServersByCid(session.channel.id) : [];
3656
+ const serverRes = channelRes.concat(userRes);
3657
+ if (serverRes.length === 0) return session.text(".server-not-found");
3658
+ let cardCode = "";
3659
+ if (!options.card) {
3660
+ const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
3661
+ if (!defaultCard) return session.text(".card-not-found");
3662
+ cardCode = defaultCard.code;
3663
+ } else {
3664
+ let cardListMsg = "";
3665
+ for (let i = 0; i < userCards.length; i++) {
3666
+ const defaultCard = await cardService.getDefaultCardByUid(session.user.id);
3667
+ if (defaultCard && userCards[i].id === defaultCard.id) {
3668
+ cardListMsg += `<p>${i + 1}. ${userCards[i].name} < 默认卡片</p>`;
3669
+ } else {
3670
+ cardListMsg += `<p>${i + 1}. ${userCards[i].name}</p>`;
3671
+ }
3672
+ }
3673
+ const msg = import_koishi9.h.unescape(session.text(".menu-select", { card_list: cardListMsg })).replace("< 默认卡片", "&lt; 默认卡片");
3674
+ await session.send(msg);
3675
+ const select = await session.prompt();
3676
+ if (!select) return session.text("commands.timeout");
3677
+ if (select === "q") return session.text(".quit");
3678
+ const selectNum = parseInt(select, 10);
3679
+ if (isNaN(selectNum) || selectNum < 1 || selectNum > userCards.length) {
3680
+ return session.text(".invalid-select");
3681
+ }
3682
+ cardCode = userCards[selectNum - 1].code;
3683
+ }
3684
+ const card2 = await cardService.getCardByCode(cardCode);
3685
+ let server2;
3686
+ if (card2.defaultServerId != void 0 && card2.defaultServerId != 0)
3687
+ server2 = await serverService.getServerById(card2.defaultServerId);
3688
+ else {
3689
+ const channelDefaultServer = atGuild ? await serverService.getDefaultServerByCid(
3690
+ session.platform,
3691
+ session.channel.id
3692
+ ) : null;
3693
+ if (channelDefaultServer) server2 = channelDefaultServer;
3694
+ else {
3695
+ const userDefaultServer = await serverService.getDefaultServerByUid(
3696
+ session.user.id
3697
+ );
3698
+ if (userDefaultServer) server2 = userDefaultServer;
3699
+ else return session.text(".server-not-found");
3700
+ }
3701
+ }
3702
+ const serverManager = ServerManager.getInstance();
3703
+ const sdvxService = serverManager.getGameService(server2.type, "sdvx");
3704
+ try {
3705
+ const scoreList = await sdvxService.getRecentScores(
3706
+ ctx,
3707
+ server2.baseUrl,
3708
+ card2.code,
3709
+ config,
3710
+ count
3711
+ );
3712
+ if (scoreList.length === 0) {
3713
+ return session.text(".no-scores-found");
3714
+ }
3715
+ const score = scoreList[0];
3716
+ session.send(session.text(".drawing"));
3717
+ const drawerManager = DrawerManager.getInstance(ctx);
3718
+ const sdvxDrawer = drawerManager.getDrawer("sdvx");
3719
+ const imageBuffer = await sdvxDrawer.generateRecentImage(
3720
+ {
3721
+ score,
3722
+ playerName: await sdvxService.getUserName(ctx, server2.baseUrl, card2.code),
3723
+ config
3724
+ },
3725
+ {
3726
+ lossless: options.lossless || false
3727
+ }
3728
+ );
3729
+ if (options.lossless) {
3730
+ return import_koishi9.h.image(imageBuffer, "image/png");
3731
+ }
3732
+ return import_koishi9.h.image(imageBuffer, "image/jpg");
3733
+ } catch (error) {
3734
+ ctx.logger("SDVX-RECENT").warn(error);
3735
+ return session.text(".error");
3736
+ }
3737
+ });
3738
+ }
3739
+ __name(recent, "recent");
3740
+
3741
+ // src/games/sdvx/commands/vf.ts
3742
+ var import_koishi10 = require("koishi");
3743
+
3427
3744
  // src/games/sdvx/services/score-service.ts
3428
3745
  var ScoreService = class _ScoreService {
3429
3746
  static {
@@ -3594,7 +3911,6 @@ __name(parseFilterQuery, "parseFilterQuery");
3594
3911
  // src/games/sdvx/commands/vf.ts
3595
3912
  function vf(ctx, config) {
3596
3913
  ctx.command("vf").userFields(["defaultCardId", "defaultServerId", "id"]).channelFields(["defaultServerId", "id"]).option("lossless", "-l").option("card", "-c").option("filter", "-f <query:text>").action(async ({ session, options }) => {
3597
- const model = config.default_model;
3598
3914
  const atGuild = session.guildId != null;
3599
3915
  const cardService = new CardService(ctx);
3600
3916
  const serverService = new ServerService(ctx);
@@ -3619,7 +3935,7 @@ function vf(ctx, config) {
3619
3935
  cardListMsg += `<p>${i + 1}. ${userCards[i].name}</p>`;
3620
3936
  }
3621
3937
  }
3622
- const msg = import_koishi9.h.unescape(session.text(".menu-select", { card_list: cardListMsg })).replace("< 默认卡片", "&lt; 默认卡片");
3938
+ const msg = import_koishi10.h.unescape(session.text(".menu-select", { card_list: cardListMsg })).replace("< 默认卡片", "&lt; 默认卡片");
3623
3939
  await session.send(msg);
3624
3940
  const select = await session.prompt();
3625
3941
  if (!select) return session.text("commands.timeout");
@@ -3682,9 +3998,9 @@ function vf(ctx, config) {
3682
3998
  }
3683
3999
  );
3684
4000
  if (options.lossless) {
3685
- return import_koishi9.h.file(imageBuffer, "image/png");
4001
+ return import_koishi10.h.file(imageBuffer, "image/png");
3686
4002
  }
3687
- return import_koishi9.h.image(imageBuffer, "image/jpg");
4003
+ return import_koishi10.h.image(imageBuffer, "image/jpg");
3688
4004
  } catch (error) {
3689
4005
  ctx.logger("SDVX-VF").warn(error);
3690
4006
  return session.text(".error");
@@ -3696,7 +4012,9 @@ __name(vf, "vf");
3696
4012
  // src/games/sdvx/command.ts
3697
4013
  var name9 = "command";
3698
4014
  function apply9(ctx, config) {
4015
+ ctx.command("sdvx").alias("s");
3699
4016
  vf(ctx, config);
4017
+ recent(ctx, config);
3700
4018
  }
3701
4019
  __name(apply9, "apply");
3702
4020
 
@@ -3731,7 +4049,7 @@ var zh_CN_default4 = { _config: { $desc: "SDVX 模块设置", default_model: "<p
3731
4049
  // src/games/sdvx/index.ts
3732
4050
  var name12 = "Noah-SDVX";
3733
4051
  var inject2 = ["database"];
3734
- var logger3 = new import_koishi10.Logger("Noah-SDVX");
4052
+ var logger3 = new import_koishi11.Logger("Noah-SDVX");
3735
4053
  async function apply12(ctx, config) {
3736
4054
  ;
3737
4055
  [
@@ -3745,47 +4063,47 @@ async function apply12(ctx, config) {
3745
4063
  __name(apply12, "apply");
3746
4064
 
3747
4065
  // src/config.ts
3748
- var import_koishi15 = require("koishi");
4066
+ var import_koishi16 = require("koishi");
3749
4067
 
3750
4068
  // src/asset/config.ts
3751
- var import_koishi11 = require("koishi");
3752
- var assetConfig = import_koishi11.Schema.object({
3753
- data_path: import_koishi11.Schema.string().default("noah_assets"),
3754
- auto_update: import_koishi11.Schema.boolean().default(true),
3755
- update_url: import_koishi11.Schema.string().default("https://github.com/logthm/noah/releases/latest/download/"),
3756
- update_interval: import_koishi11.Schema.number().default(24 * 60 * 60 * 1e3),
4069
+ var import_koishi12 = require("koishi");
4070
+ var assetConfig = import_koishi12.Schema.object({
4071
+ data_path: import_koishi12.Schema.string().default("noah_assets"),
4072
+ auto_update: import_koishi12.Schema.boolean().default(true),
4073
+ update_url: import_koishi12.Schema.string().default("https://github.com/logthm/noah/releases/latest/download/"),
4074
+ update_interval: import_koishi12.Schema.number().default(24 * 60 * 60 * 1e3),
3757
4075
  // 24 hours in milliseconds
3758
- github_token: import_koishi11.Schema.string().description("GitHub token for accessing private repositories").role("secret")
4076
+ github_token: import_koishi12.Schema.string().description("GitHub token for accessing private repositories").role("secret")
3759
4077
  }).i18n({
3760
4078
  "en-US": en_US_default._config,
3761
4079
  "zh-CN": zh_CN_default._config
3762
4080
  });
3763
4081
 
3764
4082
  // src/core/config.ts
3765
- var import_koishi12 = require("koishi");
3766
- var coreConfig = import_koishi12.Schema.object({
3767
- adminUsers: import_koishi12.Schema.array(String).role("table"),
3768
- guildNameCards: import_koishi12.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"])
4083
+ var import_koishi13 = require("koishi");
4084
+ var coreConfig = import_koishi13.Schema.object({
4085
+ adminUsers: import_koishi13.Schema.array(String).role("table"),
4086
+ guildNameCards: import_koishi13.Schema.array(String).role("table").default(["Noah | /help 获取食用指南"])
3769
4087
  }).i18n({
3770
4088
  "en-US": en_US_default2._config,
3771
4089
  "zh-CN": zh_CN_default2._config
3772
4090
  });
3773
4091
 
3774
4092
  // src/fun/poke/config.ts
3775
- var import_koishi13 = require("koishi");
3776
- var pokeConfig = import_koishi13.Schema.object({
3777
- interval: import_koishi13.Schema.number().default(1e3).step(100),
3778
- warning: import_koishi13.Schema.boolean().default(false),
3779
- prompt: import_koishi13.Schema.array(
3780
- import_koishi13.Schema.object({
3781
- content: import_koishi13.Schema.string().required(),
3782
- weight: import_koishi13.Schema.number().min(0).max(100).default(50)
4093
+ var import_koishi14 = require("koishi");
4094
+ var pokeConfig = import_koishi14.Schema.object({
4095
+ interval: import_koishi14.Schema.number().default(1e3).step(100),
4096
+ warning: import_koishi14.Schema.boolean().default(false),
4097
+ prompt: import_koishi14.Schema.array(
4098
+ import_koishi14.Schema.object({
4099
+ content: import_koishi14.Schema.string().required(),
4100
+ weight: import_koishi14.Schema.number().min(0).max(100).default(50)
3783
4101
  })
3784
4102
  ).role("table"),
3785
- messages: import_koishi13.Schema.array(
3786
- import_koishi13.Schema.object({
3787
- content: import_koishi13.Schema.string().required(),
3788
- weight: import_koishi13.Schema.number().min(0).max(100).default(50)
4103
+ messages: import_koishi14.Schema.array(
4104
+ import_koishi14.Schema.object({
4105
+ content: import_koishi14.Schema.string().required(),
4106
+ weight: import_koishi14.Schema.number().min(0).max(100).default(50)
3789
4107
  })
3790
4108
  ).role("table")
3791
4109
  }).i18n({
@@ -3794,17 +4112,17 @@ var pokeConfig = import_koishi13.Schema.object({
3794
4112
  });
3795
4113
 
3796
4114
  // src/games/sdvx/config.ts
3797
- var import_koishi14 = require("koishi");
3798
- var sdvxConfig = import_koishi14.Schema.object({
3799
- default_model: import_koishi14.Schema.string().default("2024110700"),
3800
- sdvx_data_url: import_koishi14.Schema.string().required()
4115
+ var import_koishi15 = require("koishi");
4116
+ var sdvxConfig = import_koishi15.Schema.object({
4117
+ default_model: import_koishi15.Schema.string().default("2024110700"),
4118
+ sdvx_data_url: import_koishi15.Schema.string().required()
3801
4119
  }).i18n({
3802
4120
  "en-US": en_US_default4._config,
3803
4121
  "zh-CN": zh_CN_default4._config
3804
4122
  });
3805
4123
 
3806
4124
  // src/config.ts
3807
- var Config = import_koishi15.Schema.object({
4125
+ var Config = import_koishi16.Schema.object({
3808
4126
  core: coreConfig,
3809
4127
  sdvx: sdvxConfig,
3810
4128
  poke: pokeConfig,
package/package.json CHANGED
@@ -1,76 +1,77 @@
1
1
  {
2
- "name": "koishi-plugin-noah",
3
- "version": "1.1.30",
4
- "contributors": [
5
- "Logthm <logthm@outlook.com>"
6
- ],
7
- "homepage": "https://docs.logthm.cn/noah",
8
- "type": "module",
9
- "main": "lib/index.cjs",
10
- "typings": "lib/index.d.ts",
11
- "files": [
12
- "lib",
13
- "dist"
14
- ],
15
- "license": "MIT",
16
- "keywords": [
17
- "chatbot",
18
- "koishi",
19
- "plugin"
20
- ],
21
- "peerDependencies": {
22
- "koishi": "^4.18.8"
23
- },
24
- "dependencies": {
25
- "adm-zip": "^0.5.16",
26
- "koishi-plugin-adapter-onebot": "^6.8.0",
27
- "sharp": "^0.33.5",
28
- "xml2js": "^0.6.2"
2
+ "name": "koishi-plugin-noah",
3
+ "version": "1.2.1",
4
+ "contributors": [
5
+ "Logthm <logthm@outlook.com>"
6
+ ],
7
+ "homepage": "https://docs.logthm.cn/noah",
8
+ "type": "module",
9
+ "main": "lib/index.cjs",
10
+ "typings": "lib/index.d.ts",
11
+ "files": [
12
+ "lib",
13
+ "dist"
14
+ ],
15
+ "license": "MIT",
16
+ "keywords": [
17
+ "chatbot",
18
+ "koishi",
19
+ "plugin"
20
+ ],
21
+ "peerDependencies": {
22
+ "koishi": "^4.18.8"
23
+ },
24
+ "dependencies": {
25
+ "adm-zip": "^0.5.16",
26
+ "bwip-js": "^4.6.0",
27
+ "koishi-plugin-adapter-onebot": "^6.8.0",
28
+ "sharp": "^0.33.5",
29
+ "xml2js": "^0.6.2"
30
+ },
31
+ "koishi": {
32
+ "description": {
33
+ "en": "A tool bot for arcade music games",
34
+ "zh": "街机音游工具机器人"
29
35
  },
30
- "koishi": {
31
- "description": {
32
- "en": "A tool bot for arcade music games",
33
- "zh": "街机音游工具机器人"
34
- },
35
- "service": {
36
- "required": [
37
- "database",
38
- "skia"
39
- ]
40
- },
41
- "locales": [
42
- "en",
43
- "zh"
44
- ]
36
+ "service": {
37
+ "required": [
38
+ "database",
39
+ "skia"
40
+ ]
45
41
  },
46
- "devDependencies": {
47
- "@haixee/eslint-config": "^2.1.11",
48
- "@ltxhhz/koishi-plugin-skia-canvas": "^0.0.8",
49
- "@types/adm-zip": "^0",
50
- "@types/xml2js": "^0",
51
- "eslint": "^9.29.0",
52
- "eslint-config-prettier": "^10.1.5",
53
- "eslint-plugin-prettier": "^5.5.0",
54
- "husky": "^9.1.7",
55
- "lint-staged": "^16.1.2",
56
- "prettier": "^3.5.3"
57
- },
58
- "scripts": {
59
- "lint": "eslint --ext .js,.ts,.tsx src/",
60
- "format": "prettier --write \"src/**/*.{js,ts,tsx,json,css,md}\""
61
- },
62
- "husky": {
63
- "hooks": {
64
- "pre-commit": "lint-staged"
65
- }
66
- },
67
- "lint-staged": {
68
- "*.{js,ts,tsx}": [
69
- "eslint --fix",
70
- "prettier --write"
71
- ],
72
- "*.{css,md,json}": [
73
- "prettier --write"
74
- ]
42
+ "locales": [
43
+ "en",
44
+ "zh"
45
+ ]
46
+ },
47
+ "devDependencies": {
48
+ "@haixee/eslint-config": "^2.1.11",
49
+ "@ltxhhz/koishi-plugin-skia-canvas": "^0.0.8",
50
+ "@types/adm-zip": "^0",
51
+ "@types/xml2js": "^0",
52
+ "eslint": "^9.29.0",
53
+ "eslint-config-prettier": "^10.1.5",
54
+ "eslint-plugin-prettier": "^5.5.0",
55
+ "husky": "^9.1.7",
56
+ "lint-staged": "^16.1.2",
57
+ "prettier": "^3.5.3"
58
+ },
59
+ "scripts": {
60
+ "lint": "eslint --ext .js,.ts,.tsx src/",
61
+ "format": "prettier --write \"src/**/*.{js,ts,tsx,json,css,md}\""
62
+ },
63
+ "husky": {
64
+ "hooks": {
65
+ "pre-commit": "lint-staged"
75
66
  }
67
+ },
68
+ "lint-staged": {
69
+ "*.{js,ts,tsx}": [
70
+ "eslint --fix",
71
+ "prettier --write"
72
+ ],
73
+ "*.{css,md,json}": [
74
+ "prettier --write"
75
+ ]
76
+ }
76
77
  }