Skip to content

Commit

Permalink
update for bs-grpc 0.10 and bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dvisztempacct committed Jul 20, 2018
1 parent 74b3236 commit 33ef35e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/jschatclient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Long = require('long')
const grpc = require('grpc')
const grpc = require('bs-grpc')
const chat = grpc.load('chat.proto').chat
const fs = require('fs')
const loadCert = x => fs.readFileSync(__dirname + '/../certs/'+ x)
Expand All @@ -22,7 +22,8 @@ process.stdin.on('data', chunk => {
const text = chunk.toString('utf8').trim()
const msg = {
channel: '#random',
text: chunk.toString('utf8').trim()
text: chunk.toString('utf8').trim(),
urgency: 0
}
const words = text.split(/\s+/g)
switch (words[0]) {
Expand Down Expand Up @@ -67,13 +68,16 @@ function passFail() {
chatServiceClient.passwordReset
}
function announce(password, text) {
chatServiceClient.sendPasswordedMessage({
const msg = {
password,
sendMessageRequest: {
channel: '#announcements',
text
text,
urgency: 0
}
}, (err, res) => {
}
console.log('sending announcement message', msg, chat.SendPasswordedMessageRequest.verify(msg), chat.SendPasswordedMessageRequest.fromObject(msg))
chatServiceClient.sendPasswordedMessage(msg, (err, res) => {
if (err) console.error('grpc error:', err)
else if (res.error) console.error('app error:', res.error)
else console.log('announcement acknowledged')
Expand Down

0 comments on commit 33ef35e

Please sign in to comment.