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

contributeCommandCallParser() 对CommandCallParser的扩展不运作 #1860

Closed
18111398 opened this issue Jan 30, 2022 · 2 comments · Fixed by #1889
Closed

contributeCommandCallParser() 对CommandCallParser的扩展不运作 #1860

18111398 opened this issue Jan 30, 2022 · 2 comments · Fixed by #1889
Labels
M 优先级: 主要 s:console 子系统: mirai-console t:problem 类型: 不容易归类为特性或 bug 的综合问题
Milestone

Comments

@18111398
Copy link

18111398 commented Jan 30, 2022

问题描述

即使使用contributeCommandCallParser()用自己的CommandCallParser扩展,实际编译后插件依然使用SpaceSeparatedCommandCallParser解析语句。即扩展方法完全没起到作用。

(此外实测contributeCommandCallResolver()可以如期运作,因此合理猜测只有CommandCallParser相关部分出了问题。)

复现

不想透露现在的project,因此使用没有实际作用但更能反应问题的例子。

object MyCommandCallParser: CommandCallParser {
    override fun parse(caller: CommandSender, message: MessageChain): CommandCall? {
        return CommandCallImpl(caller, "stop", listOf())
    }
}
object MyPlugin: KotlinPlugin(/*...*/) {
    /*...*/
    override fun PluginComponentStorage.onLoad() {
        contributeCommandCallParser { MyCommandCallParser }
    }
}

预期结果:MyCommandCallParser.parse()甚至未使用message参数,因此无论输入如何都会被解析为stop指令。
实际结果:语句正常解析。

mirai-core 版本

生产环境2.9.2,运行环境2.10.0-RC2

bot-protocol

ANDROID_PHONE

其他组件版本

无。

系统日志

无关。

网络日志

无关。

补充信息

No response

@Him188 Him188 added M 优先级: 主要 s:console 子系统: mirai-console t:problem 类型: 不容易归类为特性或 bug 的综合问题 labels Jan 30, 2022
@Him188 Him188 modified the milestones: 2.10.0, 2.11 Jan 30, 2022
@Him188 Him188 modified the milestones: 2.11, 2.11.0-RC Feb 10, 2022
@Him188
Copy link
Member

Him188 commented Feb 12, 2022

经检查, 问题原因是内嵌的 SpaceSeparatedCommandCallParser 优先级比插件添加的高, 导致总是使用内嵌的.

Him188 added a commit that referenced this issue Feb 17, 2022
… `priority`. Remove `builtinImplementations` and contribute them at the first initialization phase instead.

Close #1888, fix #1860.

Add `ComponentStorageInternal` for frontend to provide components.

Deprecate:
- SingletonExtension
- SingletonExtensionPoint
- AbstractSingletonExtensionPoint
- SingletonExtensionSelector
- CommandCallInterceptorProviderImpl
- CommandCallInterceptorProviderImplLazy
- CommandCallParserProviderImpl
- CommandCallParserProviderImplLazy
- CommandCallResolverProviderImpl
- CommandCallResolverProviderImplLazy

ABI breaking change:
`PermissionServiceProvider.ExtensionPoint`: supertype changed from `AbstractSingletonExtensionPoint` to `AbstractInstanceExtensionPoint`.
Him188 added a commit that referenced this issue Feb 17, 2022
… `priority`. Remove `builtinImplementations` and contribute them at the first initialization phase instead.

Close #1888, fix #1860.

Add `ComponentStorageInternal` for frontend to provide components.

Deprecate:
- SingletonExtension
- SingletonExtensionPoint
- AbstractSingletonExtensionPoint
- SingletonExtensionSelector
- CommandCallInterceptorProviderImpl
- CommandCallInterceptorProviderImplLazy
- CommandCallParserProviderImpl
- CommandCallParserProviderImplLazy
- CommandCallResolverProviderImpl
- CommandCallResolverProviderImplLazy

ABI breaking change:
`PermissionServiceProvider.ExtensionPoint`: supertype changed from `AbstractSingletonExtensionPoint` to `AbstractInstanceExtensionPoint`.
Him188 added a commit that referenced this issue Feb 17, 2022
… `priority`. Remove `builtinImplementations` and contribute them at the first initialization phase instead.

Close #1888, fix #1860.

Add `ComponentStorageInternal` for frontend to provide components.

Deprecate:
- SingletonExtension
- SingletonExtensionPoint
- AbstractSingletonExtensionPoint
- SingletonExtensionSelector
- CommandCallInterceptorProviderImpl
- CommandCallInterceptorProviderImplLazy
- CommandCallParserProviderImpl
- CommandCallParserProviderImplLazy
- CommandCallResolverProviderImpl
- CommandCallResolverProviderImplLazy

ABI breaking change:
- `PermissionServiceProvider`: supertype changed
- `CommandCallResolverProvider.ExtensionPoint`: supertype changed
- `PermissionServiceProvider.ExtensionPoint`: supertype changed
Him188 added a commit that referenced this issue Feb 22, 2022
… `priority`. Remove `builtinImplementations` and contribute them at the first initialization phase instead.

Close #1888, fix #1860.

Add `ComponentStorageInternal` for frontend to provide components.

Deprecate:
- SingletonExtension
- SingletonExtensionPoint
- AbstractSingletonExtensionPoint
- SingletonExtensionSelector
- CommandCallInterceptorProviderImpl
- CommandCallInterceptorProviderImplLazy
- CommandCallParserProviderImpl
- CommandCallParserProviderImplLazy
- CommandCallResolverProviderImpl
- CommandCallResolverProviderImplLazy

ABI breaking change:
- `PermissionServiceProvider`: supertype changed
- `CommandCallResolverProvider.ExtensionPoint`: supertype changed
- `PermissionServiceProvider.ExtensionPoint`: supertype changed
@Him188 Him188 linked a pull request Feb 24, 2022 that will close this issue
Him188 added a commit that referenced this issue Feb 24, 2022
… `priority`. Remove `builtinImplementations` and contribute them at the first initialization phase instead.

Close #1888, fix #1860.

Add `ComponentStorageInternal` for frontend to provide components.

Deprecate:
- SingletonExtension
- SingletonExtensionPoint
- AbstractSingletonExtensionPoint
- SingletonExtensionSelector
- CommandCallInterceptorProviderImpl
- CommandCallInterceptorProviderImplLazy
- CommandCallParserProviderImpl
- CommandCallParserProviderImplLazy
- CommandCallResolverProviderImpl
- CommandCallResolverProviderImplLazy

ABI breaking change:
- `PermissionServiceProvider`: supertype changed
- `CommandCallResolverProvider.ExtensionPoint`: supertype changed
- `PermissionServiceProvider.ExtensionPoint`: supertype changed
@Him188
Copy link
Member

Him188 commented Feb 24, 2022

已修复,现在可以使用预览版本 2.11.0-RC-dev-77e2a5c3 测试。

不知道为什么 GitHub 这个编辑框不能粘贴,预览版本用法可以在 开发文档-配置依赖-选择版本-预览版本 找到。

@Him188 Him188 modified the milestones: 2.11.0-RC, 2.11.0-M1 Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 优先级: 主要 s:console 子系统: mirai-console t:problem 类型: 不容易归类为特性或 bug 的综合问题
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants