Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: h.i18n 在离开 command scope 时做 transform #1095

Closed
Seidko opened this issue May 23, 2023 · 0 comments
Closed

Feature: h.i18n 在离开 command scope 时做 transform #1095

Seidko opened this issue May 23, 2023 · 0 comments
Labels

Comments

@Seidko
Copy link
Member

Seidko commented May 23, 2023

Describe the problem related to the feature request

h.i18n 在离开 command scope 时如果使用缩写会报 Missing scope 错误。

ctx.command('foo').action(async ({ session }) => {
  // 不报错
  await session.send(h.i18n('.info'))
  // 不报错
  return session.text('.success')
})

ctx.command('bar').action(async ({ session }) => {
  // 不报错
  await session.send(session.text('.info'))
  // 报错
  return h.i18n('.success')
})

经过分析,在离开 command scope 之后使用缩写 koishi 会找不到是哪个 command 发出的元素,故而报 Missing scope 错误。

Describe the solution you'd like

如果在消息元素离开函数作用域的时候将 i18n 进行 transform,这样 koishi 就可以知道是哪个 command scope 了,然后进行 transform,避免之后出现 Missing scope 错误。

Describe alternatives you've considered

No response

Additional context

No response

@Seidko Seidko added the feature 新特性 label May 23, 2023
@shigma shigma closed this as completed in 3e87185 May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants