Skip to content

Commit 8a2c154

Browse files
committed
query_bind
1 parent bc24fb3 commit 8a2c154

File tree

1 file changed

+11
-0
lines changed
  • packages/botcore/src/modules/admin

1 file changed

+11
-0
lines changed

packages/botcore/src/modules/admin/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import NoReportError from '../../utils/NoReportError';
33
import { BotTypes } from '@clansty/maibot-firm';
44
import { BuilderEnv } from '../../botBuilder';
55
import UserContext from '../../UserContext';
6+
import { UserProfilesKVStorage } from '@clansty/maibot-types';
67

78
export default <T extends BotTypes>({ bot, env, getContext, musicToFile }: BuilderEnv<T>) => {
89
const client = new AdminClient(env.ADMIN_SECRET, env.ADMIN_BASE);
@@ -24,6 +25,16 @@ export default <T extends BotTypes>({ bot, env, getContext, musicToFile }: Build
2425
return true;
2526
});
2627

28+
bot.registerCommand('query_bind', async (event) => {
29+
checkAdminUser(event.fromId);
30+
31+
const username = event.params[0];
32+
const res = await env.KV.get<UserProfilesKVStorage>(`profiles:${username}`);
33+
await event.reply().setText(res.profiles.map(it => JSON.stringify(it)).join('\n\n')).dispatch();
34+
35+
return true;
36+
});
37+
2738
bot.registerCommand('debug_net_card', async (event) => {
2839
checkAdminUser(event.fromId);
2940

0 commit comments

Comments
 (0)