koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.45k stars 242 forks source link

Feature: callme服务 #1035

Open Coin0804 opened 1 year ago

Coin0804 commented 1 year ago

Describe the problem related to the feature request

我现在在开发trpgdice这个插件发现callme之后我就尝试去使用它来为我的插件增添一个定制昵称的功能,以更加符合跑团时的称呼。但我发现,callme只是把name写进了数据库,而我要调用的话实际上没有一个接口,而是要到数据库里直接读取。我就想,要是callme是一个服务就好了。

Describe the solution you'd like

如果把callme做成一个可选服务的话,在其他插件中就可以尝试通过callme服务的某些方法,例如callme.getNick来获取可能的昵称,而不必非得直接依赖于数据库读取不一定存在的昵称。

Describe alternatives you've considered

我还考虑过新写一个插件,来提供callme的服务,这个插件依赖database,也是可以实现的,但既然单独把callme已经做成插件了,那由callme直接提供callme服务显然是更佳选择。

Additional context

No response

shigma commented 1 year ago

目前来说直接从 database 读取是很方便的(指令中直接配置 userFields 即可)。

此外 callme 的功能也在考虑继续完善,你有什么建议的话也可以在下面说。

Coin0804 commented 1 year ago

目前来说直接从 database 读取是很方便的(指令中直接配置 userFields 即可)。

此外 callme 的功能也在考虑继续完善,你有什么建议的话也可以在下面说。

唔,如果将callme作为完整的全功能称呼插件,我希望能提供以下功能:

当然,这其中的实现涉及到依赖问题,作为官方插件,callme实际上不该有过多依赖,具体的功能未必需要这么复杂,如果能起到一些帮助作用就足够了。

purerosefallen commented 1 year ago

Why don't you use session.username?

Coin0804 commented 1 year ago

Why don't you use session.username?

When people playing TRPG(Tabletop Role-Playing Game), they always playing in a role. Forexample, my name is Alice in the game. When I roll a dice, the bot return a info like "coin0804 rolled 1d100=50"(session.username is coin0804). However, it supposed to be "Alice rolled 1d100=50". Player won't like to change is't name which is used as session.username. So I need another way to set nickname. The 'callme' plugin is already exists and is offical. I hope it could be well used.