NotificamBot/test-publish.js

30 lines
512 B
JavaScript
Raw Normal View History

2020-06-21 17:24:53 +02:00
const redis = require('redis');
2022-01-31 16:19:33 +01:00
const prompt = require('prompt');
2020-06-21 17:24:53 +02:00
2022-01-31 16:19:33 +01:00
require('dotenv').config();
2020-06-21 17:24:53 +02:00
2022-01-31 16:19:33 +01:00
const {
REDIS_CHANNEL,
REDIS_PASSWORD
} = process.env;
2020-06-21 17:24:53 +02:00
2022-01-31 16:19:33 +01:00
const publisher = redis.createClient({
url: `redis://:${REDIS_PASSWORD}@localhost`
});
prompt.start();
prompt.get(['type', 'description'], (err, result) => {
publisher.publish(REDIS_CHANNEL, JSON.stringify({
type: result.type ,
description: result.description,
options: {}
}));
publisher.quit();
})
2020-06-21 17:24:53 +02:00