Add support for sending stats to Matrix, split out some code into more generic classes. #1

Open
rory.gay wants to merge 35 commits from rory.gay/freepbx-stats:main into main
Showing only changes of commit 2731ccd7f9 - Show all commits

View file

@ -137,7 +137,7 @@ async function sendSummary() {
} }
async function sendSummaryMatrix(yesterday, stats) { async function sendSummaryMatrix(yesterday, stats) {
const html = ``` const html = `
<table> <table>
<thead> <thead>
<tr> <tr>
@ -153,7 +153,7 @@ async function sendSummaryMatrix(yesterday, stats) {
${stats.isNewRecord ? `<tr><td colspan="2">🎉 NEW RECORD! 🎉 A new record has been set, at ${stats.totalCallsMade}!</td></tr>` : ''} ${stats.isNewRecord ? `<tr><td colspan="2">🎉 NEW RECORD! 🎉 A new record has been set, at ${stats.totalCallsMade}!</td></tr>` : ''}
</tbody> </tbody>
</table> </table>
```; `;
var message = { var message = {
"msgtype": "m.text", "msgtype": "m.text",
"format": "org.matrix.custom.html", "format": "org.matrix.custom.html",