Skip to content

Commit 0b4d6fb

Browse files
committed
停止官方 Bot 支持
1 parent c3a83da commit 0b4d6fb

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

apps/qqbot/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ process.on('uncaughtException', (error: any) => {
2929
});
3030

3131
env.KV = new LevelKV();
32+
env.BOT_TYPE = 'qq';
3233
const renderer = new Renderer();
3334

3435
const bot = new BotAdapter(env);

apps/qqofbot/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ process.on('uncaughtException', (error: any) => {
2929
});
3030

3131
env.KV = new LevelKV();
32+
env.BOT_TYPE = 'qq-official';
3233
const renderer = new Renderer();
3334

3435
const bot = new BotAdapter(env);

apps/tgbot/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default withSentry(
2525
);
2626

2727
const tryHandleUpdate = async (update: Update, env: Env) => {
28+
env.BOT_TYPE = 'qq-official';
2829
const bot = createBot(env);
2930
try {
3031
await bot.handleUpdate(update);

packages/botcore/src/modules/bind.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ import { BotTypes, MessageButtonCallback, SendMessageAction } from '@clansty/mai
44
import { BuilderEnv } from '../botBuilder';
55
import UserContext from '../UserContext';
66

7+
const time = 1755187200;
8+
79
export default <T extends BotTypes>({ bot, env, getContext, musicToFile, enableOfficialServers }: BuilderEnv<T>) => {
810
const handleQueryBind = async (ctx: UserContext<T>, reply: SendMessageAction<T>) => {
911
const profiles = await ctx.getProfiles();
1012
let bond = '';
1113
if (profiles.length) {
1214
bond += `\n\n现在已经绑定 ${profiles.length} 个账号\n使用 /profile 命令来查看已经绑定的账号\n使用 /delprofile 命令可以删除已经绑定的账号`;
1315
}
16+
let botExtra = '';
17+
if (env.BOT_TYPE == 'qq') {
18+
botExtra = '\n2025 / 8 / 15 之前,默认绑定的网络为 AquaDX,2025 / 8 / 15 之后将更改为 MuNET';
19+
} else if (env.BOT_TYPE == 'qq-official') {
20+
botExtra = '\n正在逐步停止 QQ 官方 Bot 的支持,请使用 QQ 号 3087530651 的 Bot。官方 Bot 的绑定将于 2025 / 8 / 15 之后停止,已绑定的用户可以继续使用,但无法再绑定新的用户。';
21+
}
1422
await reply
1523
.setHtml('用法: /bind [--munet] [--aquadx] <code>AquaDX / MuNET 的用户名</code>' + (enableOfficialServers ? ' 或 <code>国服微信二维码识别出来的文字</code> 或 <code>AIME 卡背后的 20 位数字(国际服)</code>' : '') +
16-
'\n2025 / 8 / 15 之前,默认绑定的网络为 AquaDX,2025 / 8 / 15 之后将更改为 MuNET' + bond)
24+
botExtra + bond)
1725
.dispatch();
1826
};
1927

@@ -33,10 +41,16 @@ export default <T extends BotTypes>({ bot, env, getContext, musicToFile, enableO
3341
return true;
3442
}
3543

44+
if (env.BOT_TYPE == 'qq-official' && Date.now() / 1000 > time) {
45+
await event.reply()
46+
.setText('正在逐步停止 QQ 官方 Bot 的支持,请使用 QQ 号 3087530651 的 Bot。官方 Bot 的绑定已于 2025 / 8 / 15 之后停止,已绑定的用户可以继续使用,但无法再绑定新的用户。')
47+
.dispatch();
48+
return true;
49+
}
50+
3651
let minato = event.params.includes('--minato') || event.params.includes('--munet') || event.params.includes('—munet') || event.params.includes('-munet');
3752
let aquadx = event.params.includes('--aquadx') || event.params.includes('—aquadx') || event.params.includes('-aquadx');
3853

39-
const time = 1755187200;
4054
if (!minato && !aquadx) {
4155
if (Date.now() / 1000 < time) {
4256
aquadx = true;

packages/types/src/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ export interface BotEnv extends Env {
264264
GENIUS_SECRET: string;
265265
TELEGRAPH_SECRET: string;
266266
DEEPL_AUTH_KEY: string;
267+
BOT_TYPE: 'qq' | 'telegram' | 'qq-official';
267268
}
268269

269270
export type MaiVersion = 140 | 145 | 150 | 155

0 commit comments

Comments
 (0)