koishi-plugin-steam-info-check 1.0.6 → 1.0.7

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/dist/index.js CHANGED
@@ -37,6 +37,7 @@ exports.logger = new koishi_1.Logger('steam-info');
37
37
  function apply(ctx, config) {
38
38
  // Localization
39
39
  ctx.i18n.define('zh-CN', zh_CN_1.default);
40
+ ctx.i18n.define('zh', zh_CN_1.default);
40
41
  // Services
41
42
  ctx.plugin(service_1.SteamService, config);
42
43
  ctx.plugin(drawer_1.DrawService, config);
@@ -63,7 +64,7 @@ function apply(ctx, config) {
63
64
  });
64
65
  // Commands and scheduler depend on steam/drawer being ready
65
66
  ctx.using(['steam', 'drawer'], (ctx) => {
66
- ctx.command('steam', 'Steam Information');
67
+ ctx.command('steam', 'Steam 信息');
67
68
  ctx.command('steam.bind <steamId:string>', 'Bind Steam ID', { authority: config.commandAuthority.bind })
68
69
  .alias('steambind', '绑定steam')
69
70
  .action(async ({ session }, steamId) => {
@@ -244,6 +245,17 @@ async function ensureChannelMeta(ctx, session) {
244
245
  if (!name && session.event?.channel?.name) {
245
246
  name = session.event.channel.name;
246
247
  }
248
+ // OneBot 群名补充
249
+ if (!name && session.platform?.includes('onebot') && session.bot?.internal?.getGroupInfo) {
250
+ try {
251
+ const info = await session.bot.internal.getGroupInfo({ group_id: channelId });
252
+ if (info?.group_name)
253
+ name = info.group_name;
254
+ }
255
+ catch {
256
+ /* ignore */
257
+ }
258
+ }
247
259
  let avatar = current.avatar;
248
260
  if (!avatar) {
249
261
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-steam-info-check",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Steam friends status broadcast plugin for Koishi",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -65,6 +65,7 @@ declare module 'koishi' {
65
65
  export function apply(ctx: Context, config: Config) {
66
66
  // Localization
67
67
  ctx.i18n.define('zh-CN', zhCN)
68
+ ctx.i18n.define('zh', zhCN)
68
69
 
69
70
  // Services
70
71
  ctx.plugin(SteamService, config)
@@ -95,7 +96,7 @@ export function apply(ctx: Context, config: Config) {
95
96
 
96
97
  // Commands and scheduler depend on steam/drawer being ready
97
98
  ctx.using(['steam', 'drawer'], (ctx) => {
98
- ctx.command('steam', 'Steam Information')
99
+ ctx.command('steam', 'Steam 信息')
99
100
 
100
101
  ctx.command('steam.bind <steamId:string>', 'Bind Steam ID', { authority: config.commandAuthority.bind })
101
102
  .alias('steambind', '绑定steam')
@@ -278,6 +279,15 @@ async function ensureChannelMeta(ctx: Context, session: Session) {
278
279
  if (!name && session.event?.channel?.name) {
279
280
  name = session.event.channel.name
280
281
  }
282
+ // OneBot 群名补充
283
+ if (!name && session.platform?.includes('onebot') && session.bot?.internal?.getGroupInfo) {
284
+ try {
285
+ const info = await session.bot.internal.getGroupInfo({ group_id: channelId })
286
+ if (info?.group_name) name = info.group_name
287
+ } catch {
288
+ /* ignore */
289
+ }
290
+ }
281
291
 
282
292
  let avatar = current.avatar
283
293
  if (!avatar) {