Koishi describes itself as a "cross-platform" framework, but what does this "cross-platform" mean?This doesn't just mean that Koishi supports multiple running platforms, but that Koishi can access multiple chat platforms simultaneously and provide the most native experience possible:
- Koishi 提供了统一的接口，你可以在任何聊天平台上享受完整的 Koishi 生态。
- Koishi 应用可以同时接入多个聊天平台，用户可以在任意平台上与你的机器人进行交互。
- Koishi 原生地支持了跨平台账号绑定，这使得用户可以带着全部数据进行无感迁移。
现在就让我们来说说，如何在 Koishi 中使用跨平台的账号系统。
The auth plugin allows any user to log in and manage their Koishi account from the console.In addition, the plugin comes with an administrator account, which is the most convenient way to raise the rights of users who have just built Koishi.
Configure Login Plugin
Click on the Auth plugin in the Plugin Configuration screen.At this point we will see that there is an "Administrator Settings" tab.
Enter the password you've prepared. Click "Activate plugin".Select "User Password Login", enter the username (default
admin if you haven't changed it) and password you just configured, and click "Login" to enter your personal page.
Ordinary user login
If you are a regular user of the bot and the bot is configured with the console login plugin, then when you first enter the console, you will find that only a few pages are accessible.The reason for this is that you do not have a login.
Enter your Platform Name and User ID when you clicked the lower left Login button and selected Platform Account Login.Click "Get Verification Code" and send the verification code that appears on the page to the bot via the private chat of the account above to complete the registration.
Once you are logged in, you will be redirected to your personal page.In this page you can change your username and password.Ordinary users can only log in with their platform account for the first time, and after setting a username and password, click "Apply Changes" in the upper right corner to log in with a user password in the future.
Koishi supports account binding. This means that one Koishi account can correspond to multiple platform users at the same time.No matter what platform you are interacting with the bot on, the data will be shared once the binding is complete.
Koishi currently offers two official plugins for account binding, which we will introduce one by one.
Binding in the console
Any user can bind a platform account to their personal page after logging in to the console.Click the "Add" button to the right of "Platform Account Binding" and complete the process by logging in with the account you want to bind, and you're done.
Click the "Disconnect" button on the right side of the platform account if you wish to disconnect.
Binding by command
bind The plugin also implements the binding of accounts by means of a command.Using the platform account you want to bind to, send
bind to the bot:
Using the original platform account, follow the prompt and send
Koishi/123456 to the bot.The binding is complete at this point if your first message is a private chat message.The bot will ask you to confirm again if your first message is a guild chat message:
Follow the prompts again and send
Koishi/654321 to the bot using the target platform account to complete the binding.
Once the binding is complete, you can unbind the state at any time by sending
bind -r to the robot from the target platform.