Add src/modules/tab_complete.js

This commit is contained in:
aaa 2024-09-25 11:10:46 -04:00
parent 2a812961e1
commit b273ef92f8

View file

@ -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)
})
}
}