chore: initial commit

This commit is contained in:
2026-10-22 17:07:08 +08:00
commit 0acef64f48
200 changed files with 35546 additions and 0 deletions
@@ -0,0 +1,22 @@
import type {Bot} from '@wp2508/mineflayer';
import type {BaseFunction, FunctionArgument} from '../../../types/bot/function/function.ts';
export class init implements BaseFunction<[]> {
readonly name = 'close_current_window';
readonly i18n = {
lang: 'zh-CN', name: '关闭当前窗口', description: '关闭当前打开的容器窗口;没有打开窗口时直接成功',
};
readonly args: FunctionArgument[] = [];
async run(bot: Bot, args: []): Promise<boolean> {
if (!Array.isArray(args) || args.length !== 0) return false;
const window = bot.currentWindow;
if (!window) return true;
try {
await bot.closeWindow(window);
return bot.currentWindow == null;
} catch {
return false;
}
}
}