22 lines
No EOL
636 B
JavaScript
22 lines
No EOL
636 B
JavaScript
function inject (client) {
|
|
const tab_complete = (str) => {
|
|
return new Promise((resolve) => {
|
|
client.write('tab_complete', {
|
|
text: str, assumeCommand: false, sendBlockInSight: false
|
|
})
|
|
|
|
const tab_completeH = (packet) => {
|
|
client.removeListener('tab_complete', tab_completeH)
|
|
|
|
resolve(packet.matches)
|
|
}
|
|
|
|
client.setMaxListeners(0)
|
|
client.once('tab_complete', tab_completeH)
|
|
})
|
|
}
|
|
client.tab_complete = tab_complete;
|
|
return tab_complete;
|
|
}
|
|
|
|
module.exports = { inject }; |