radium-v2/plugins/tabComplete.js

22 lines
636 B
JavaScript
Raw Permalink Normal View History

2024-11-05 21:04:34 -05:00
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 };