chatty-pub/node_modules/zulip-js/examples/typing-notifications/send-often.js
كارل مبارك 374620645c initial commit
2021-06-26 13:12:56 +02:00

25 lines
558 B
JavaScript

const zulip = require('../../lib');
if (process.argv.length < 6) {
console.log(
'Usage: $node examples/typing-notifications/send-often.js realm-url sender-username sender-API-key recipient-user-ID'
);
process.exit(1);
}
const [, , realm, sender, senderAPIKey, recipient] = process.argv;
(async () => {
const senderClient = await zulip({
username: sender,
apiKey: senderAPIKey,
realm,
});
setInterval(async () => {
await senderClient.typing.send({
to: [Number(recipient)],
op: 'start',
});
}, 1500);
})();