@team-choco/shell-platform
Advanced tools
Comparing version
@@ -117,3 +117,9 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
message(serverID, channelID, messageID) { | ||
throw new Error('Method not implemented.'); | ||
try { | ||
const _this2 = this; | ||
return Promise.resolve(_this2.messages.find(message => message.server_id === serverID && message.id === messageID) || null); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
} | ||
@@ -123,10 +129,10 @@ | ||
try { | ||
const _this2 = this; | ||
const _this3 = this; | ||
const info = _this2.info(); | ||
const info = _this3.info(); | ||
const content = convertChocoMessageOptionsToContent(options); | ||
const id = (_this2.counters.message++).toString(); | ||
const id = (_this3.counters.message++).toString(); | ||
_this2.write(_this2.options.name, content, id); | ||
_this3.write(_this3.options.name, content, id); | ||
@@ -142,8 +148,8 @@ const message = { | ||
content: content, | ||
reply: _this2.send.bind(_this2, channelID), | ||
edit: _this2.edit.bind(_this2, channelID, id), | ||
react: _this2.react.bind(_this2, channelID, id) | ||
reply: _this3.send.bind(_this3, channelID), | ||
edit: _this3.edit.bind(_this3, channelID, id), | ||
react: _this3.react.bind(_this3, channelID, id) | ||
}; | ||
_this2.messages.push(message); | ||
_this3.messages.push(message); | ||
@@ -158,11 +164,11 @@ return Promise.resolve(message); | ||
try { | ||
const _this3 = this; | ||
const _this4 = this; | ||
options.content = options.content ? `EDIT: ${options.content}` : 'EDIT'; | ||
const info = _this3.info(); | ||
const info = _this4.info(); | ||
const content = convertChocoMessageOptionsToContent(options); | ||
_this3.write(_this3.options.name, content, messageID); | ||
_this4.write(_this4.options.name, content, messageID); | ||
@@ -178,8 +184,8 @@ const message = { | ||
content: content, | ||
reply: _this3.send.bind(_this3, channelID), | ||
edit: _this3.edit.bind(_this3, channelID, messageID), | ||
react: _this3.react.bind(_this3, channelID, messageID) | ||
reply: _this4.send.bind(_this4, channelID), | ||
edit: _this4.edit.bind(_this4, channelID, messageID), | ||
react: _this4.react.bind(_this4, channelID, messageID) | ||
}; | ||
_this3.messages.push(message); | ||
_this4.messages.push(message); | ||
@@ -194,5 +200,5 @@ return Promise.resolve(message); | ||
try { | ||
const _this4 = this; | ||
const _this5 = this; | ||
_this4.write('SYSTEM', `${_this4.prefix(_this4.options.name)} reacted with "${emoji}" to message "${messageID}".`); | ||
_this5.write('SYSTEM', `${_this5.prefix(_this5.options.name)} reacted with "${emoji}" to message "${messageID}".`); | ||
@@ -207,7 +213,7 @@ return Promise.resolve(); | ||
try { | ||
const _this5 = this; | ||
const _this6 = this; | ||
_this5.write('SYSTEM', `Status updated to "${status}".`); | ||
_this6.write('SYSTEM', `Status updated to "${status}".`); | ||
_this5.write('SYSTEM', `Activity updated to "${activity}".`); | ||
_this6.write('SYSTEM', `Activity updated to "${activity}".`); | ||
@@ -222,5 +228,5 @@ return Promise.resolve(); | ||
try { | ||
const _this6 = this; | ||
const _this7 = this; | ||
_this6.rl.close(); | ||
_this7.rl.close(); | ||
@@ -235,6 +241,6 @@ return Promise.resolve(); | ||
try { | ||
const _this7 = this; | ||
const _this8 = this; | ||
function _temp2() { | ||
const author = who || _this7.options.whoami; | ||
const author = who || _this8.options.whoami; | ||
const chocoMessage = { | ||
@@ -249,10 +255,10 @@ id: id, | ||
content: content.trim(), | ||
reply: _this7.send.bind(_this7, CHANNEL_ID), | ||
edit: _this7.edit.bind(_this7, CHANNEL_ID, id), | ||
react: _this7.react.bind(_this7, CHANNEL_ID, id) | ||
reply: _this8.send.bind(_this8, CHANNEL_ID), | ||
edit: _this8.edit.bind(_this8, CHANNEL_ID, id), | ||
react: _this8.react.bind(_this8, CHANNEL_ID, id) | ||
}; | ||
_this7.messages.push(chocoMessage); | ||
_this8.messages.push(chocoMessage); | ||
_this7.emit('message', chocoMessage); | ||
_this8.emit('message', chocoMessage); | ||
} | ||
@@ -263,9 +269,9 @@ | ||
const [,, who, content] = match; | ||
if ([_this7.options.name, _this7.options.whoami].includes(who)) return Promise.resolve(); | ||
const id = (_this7.counters.message++).toString(); // Handle it! | ||
if ([_this8.options.name, _this8.options.whoami].includes(who)) return Promise.resolve(); | ||
const id = (_this8.counters.message++).toString(); // Handle it! | ||
const _temp = function () { | ||
if (!who) { | ||
return Promise.resolve(_this7.clear(-1)).then(function () { | ||
_this7.write(_this7.options.whoami, content, id); | ||
return Promise.resolve(_this8.clear(-1)).then(function () { | ||
_this8.write(_this8.options.whoami, content, id); | ||
}); | ||
@@ -272,0 +278,0 @@ } |
@@ -115,3 +115,9 @@ import readline from 'readline'; | ||
message(serverID, channelID, messageID) { | ||
throw new Error('Method not implemented.'); | ||
try { | ||
const _this2 = this; | ||
return Promise.resolve(_this2.messages.find(message => message.server_id === serverID && message.id === messageID) || null); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
} | ||
@@ -121,10 +127,10 @@ | ||
try { | ||
const _this2 = this; | ||
const _this3 = this; | ||
const info = _this2.info(); | ||
const info = _this3.info(); | ||
const content = convertChocoMessageOptionsToContent(options); | ||
const id = (_this2.counters.message++).toString(); | ||
const id = (_this3.counters.message++).toString(); | ||
_this2.write(_this2.options.name, content, id); | ||
_this3.write(_this3.options.name, content, id); | ||
@@ -140,8 +146,8 @@ const message = { | ||
content: content, | ||
reply: _this2.send.bind(_this2, channelID), | ||
edit: _this2.edit.bind(_this2, channelID, id), | ||
react: _this2.react.bind(_this2, channelID, id) | ||
reply: _this3.send.bind(_this3, channelID), | ||
edit: _this3.edit.bind(_this3, channelID, id), | ||
react: _this3.react.bind(_this3, channelID, id) | ||
}; | ||
_this2.messages.push(message); | ||
_this3.messages.push(message); | ||
@@ -156,11 +162,11 @@ return Promise.resolve(message); | ||
try { | ||
const _this3 = this; | ||
const _this4 = this; | ||
options.content = options.content ? `EDIT: ${options.content}` : 'EDIT'; | ||
const info = _this3.info(); | ||
const info = _this4.info(); | ||
const content = convertChocoMessageOptionsToContent(options); | ||
_this3.write(_this3.options.name, content, messageID); | ||
_this4.write(_this4.options.name, content, messageID); | ||
@@ -176,8 +182,8 @@ const message = { | ||
content: content, | ||
reply: _this3.send.bind(_this3, channelID), | ||
edit: _this3.edit.bind(_this3, channelID, messageID), | ||
react: _this3.react.bind(_this3, channelID, messageID) | ||
reply: _this4.send.bind(_this4, channelID), | ||
edit: _this4.edit.bind(_this4, channelID, messageID), | ||
react: _this4.react.bind(_this4, channelID, messageID) | ||
}; | ||
_this3.messages.push(message); | ||
_this4.messages.push(message); | ||
@@ -192,5 +198,5 @@ return Promise.resolve(message); | ||
try { | ||
const _this4 = this; | ||
const _this5 = this; | ||
_this4.write('SYSTEM', `${_this4.prefix(_this4.options.name)} reacted with "${emoji}" to message "${messageID}".`); | ||
_this5.write('SYSTEM', `${_this5.prefix(_this5.options.name)} reacted with "${emoji}" to message "${messageID}".`); | ||
@@ -205,7 +211,7 @@ return Promise.resolve(); | ||
try { | ||
const _this5 = this; | ||
const _this6 = this; | ||
_this5.write('SYSTEM', `Status updated to "${status}".`); | ||
_this6.write('SYSTEM', `Status updated to "${status}".`); | ||
_this5.write('SYSTEM', `Activity updated to "${activity}".`); | ||
_this6.write('SYSTEM', `Activity updated to "${activity}".`); | ||
@@ -220,5 +226,5 @@ return Promise.resolve(); | ||
try { | ||
const _this6 = this; | ||
const _this7 = this; | ||
_this6.rl.close(); | ||
_this7.rl.close(); | ||
@@ -233,6 +239,6 @@ return Promise.resolve(); | ||
try { | ||
const _this7 = this; | ||
const _this8 = this; | ||
function _temp2() { | ||
const author = who || _this7.options.whoami; | ||
const author = who || _this8.options.whoami; | ||
const chocoMessage = { | ||
@@ -247,10 +253,10 @@ id: id, | ||
content: content.trim(), | ||
reply: _this7.send.bind(_this7, CHANNEL_ID), | ||
edit: _this7.edit.bind(_this7, CHANNEL_ID, id), | ||
react: _this7.react.bind(_this7, CHANNEL_ID, id) | ||
reply: _this8.send.bind(_this8, CHANNEL_ID), | ||
edit: _this8.edit.bind(_this8, CHANNEL_ID, id), | ||
react: _this8.react.bind(_this8, CHANNEL_ID, id) | ||
}; | ||
_this7.messages.push(chocoMessage); | ||
_this8.messages.push(chocoMessage); | ||
_this7.emit('message', chocoMessage); | ||
_this8.emit('message', chocoMessage); | ||
} | ||
@@ -261,9 +267,9 @@ | ||
const [,, who, content] = match; | ||
if ([_this7.options.name, _this7.options.whoami].includes(who)) return Promise.resolve(); | ||
const id = (_this7.counters.message++).toString(); // Handle it! | ||
if ([_this8.options.name, _this8.options.whoami].includes(who)) return Promise.resolve(); | ||
const id = (_this8.counters.message++).toString(); // Handle it! | ||
const _temp = function () { | ||
if (!who) { | ||
return Promise.resolve(_this7.clear(-1)).then(function () { | ||
_this7.write(_this7.options.whoami, content, id); | ||
return Promise.resolve(_this8.clear(-1)).then(function () { | ||
_this8.write(_this8.options.whoami, content, id); | ||
}); | ||
@@ -270,0 +276,0 @@ } |
{ | ||
"name": "@team-choco/shell-platform", | ||
"version": "0.1.17", | ||
"version": "0.1.19", | ||
"description": "Connect your bot to your local Shell!", | ||
@@ -35,3 +35,3 @@ "repository": { | ||
}, | ||
"gitHead": "747de2eb928e0ad6a2f806cf8beaa6f1f1a19f1a" | ||
"gitHead": "17f7fcac6831abd001e9ab57a602f0414226128f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48357
1.43%528
1.93%