Files
traxxx-web/tools/notify.js

37 lines
743 B
JavaScript

import process from 'node:process';
import yargs from 'yargs';
import { notify } from '../src/alerts.js';
import { knexOwner as knex } from '../src/knex.js';
import redis from '../src/redis.js';
const { argv } = yargs(process.argv.slice(2))
.option('scenes', {
type: 'array',
alias: ['scene-ids'],
})
.option('user-ids', {
type: 'array',
alias: ['users', 'user'],
});
async function triggerNotify() {
if (!argv.scenes?.length) {
throw new Error('Must specify at least one scene ID');
}
if (!argv.userIds?.length) {
throw new Error('Must specify at least one user ID');
}
await notify(argv.scenes, {
spoofNew: true,
spoofUserIds: argv.userIds,
});
await knex.destroy();
await redis.quit();
}
triggerNotify();