From b273ef92f85d7751772dba2fe0afb4588da526d2 Mon Sep 17 00:00:00 2001 From: aaa Date: Wed, 25 Sep 2024 11:10:46 -0400 Subject: [PATCH] Add src/modules/tab_complete.js --- src/modules/tab_complete.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/modules/tab_complete.js diff --git a/src/modules/tab_complete.js b/src/modules/tab_complete.js new file mode 100644 index 0000000..5cccda7 --- /dev/null +++ b/src/modules/tab_complete.js @@ -0,0 +1,18 @@ +module.exports = (bot) => { + // let aaa cook + bot.tab_complete = (str) => { + return new Promise((resolve) => { + bot._client.write('tab_complete', { + text: str, assumeCommand: false, sendBlockInSight: false + }) + + const tab_completeH = (packet) => { + bot._client.removeListener('tab_complete', tab_completeH) + + resolve(packet.matches) + } + + bot._client.once('tab_complete', tab_completeH) + }) + } +} \ No newline at end of file