add helper to fetch all waiting messages, and add command bot example

This commit is contained in:
liamcottle 2025-03-04 17:36:22 +13:00
parent 166762dc31
commit a03023b771
3 changed files with 102 additions and 30 deletions

View file

@ -780,6 +780,27 @@ class Connection extends EventEmitter {
});
}
async getWaitingMessages() {
const waitingMessages = [];
while(true){
// get next message, otherwise stop if nothing is returned
const message = await this.syncNextMessage();
if(!message){
break;
}
// add to waiting messages list
waitingMessages.push(message);
}
return waitingMessages;
}
getDeviceTime() {
return new Promise(async (resolve, reject) => {
try {