Add src/modules/tab_complete.js
This commit is contained in:
parent
2a812961e1
commit
b273ef92f8
1 changed files with 18 additions and 0 deletions
18
src/modules/tab_complete.js
Normal file
18
src/modules/tab_complete.js
Normal 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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue