@azteam/telegram-api
Advanced tools
Comparing version 1.1.60 to 1.1.61
@@ -88,2 +88,3 @@ "use strict"; | ||
var option, | ||
text, | ||
_args3 = arguments; | ||
@@ -95,11 +96,12 @@ return _regeneratorRuntime().wrap(function _callee3$(_context3) { | ||
option = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {}; | ||
text = message; | ||
if (Array.isArray(message)) { | ||
message = message.join('\n'); | ||
text = message.join('\n'); | ||
} | ||
return _context3.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), _objectSpread({ | ||
chat_id: id, | ||
text: message, | ||
text: text, | ||
parse_mode: 'HTML' | ||
}, option))); | ||
case 3: | ||
case 4: | ||
case "end": | ||
@@ -121,2 +123,3 @@ return _context3.stop(); | ||
var option, | ||
text, | ||
_args4 = arguments; | ||
@@ -128,4 +131,5 @@ return _regeneratorRuntime().wrap(function _callee4$(_context4) { | ||
option = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : {}; | ||
text = message; | ||
if (Array.isArray(message)) { | ||
message = message.join('\n'); | ||
text = message.join('\n'); | ||
} | ||
@@ -135,6 +139,6 @@ return _context4.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), _objectSpread({ | ||
reply_to_message_id: replyID, | ||
text: message, | ||
text: text, | ||
parse_mode: 'HTML' | ||
}, option))); | ||
case 3: | ||
case 4: | ||
case "end": | ||
@@ -152,5 +156,8 @@ return _context4.stop(); | ||
}, { | ||
key: "sendMenu", | ||
key: "editMessage", | ||
value: function () { | ||
var _sendMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id, message, menu) { | ||
var _editMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id, messageId, message) { | ||
var option, | ||
text, | ||
_args5 = arguments; | ||
return _regeneratorRuntime().wrap(function _callee5$(_context5) { | ||
@@ -160,4 +167,35 @@ while (1) { | ||
case 0: | ||
return _context5.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), { | ||
option = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : {}; | ||
text = message; | ||
if (Array.isArray(message)) { | ||
text = message.join('\n'); | ||
} | ||
return _context5.abrupt("return", this.client.post("".concat(this.endpoint, "/editMessageText"), _objectSpread({ | ||
chat_id: id, | ||
message_id: messageId, | ||
text: text, | ||
parse_mode: 'HTML' | ||
}, option))); | ||
case 4: | ||
case "end": | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee5, this); | ||
})); | ||
function editMessage(_x10, _x11, _x12) { | ||
return _editMessage.apply(this, arguments); | ||
} | ||
return editMessage; | ||
}() | ||
}, { | ||
key: "sendMenu", | ||
value: function () { | ||
var _sendMenu = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, message, menu) { | ||
return _regeneratorRuntime().wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
return _context6.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), { | ||
chat_id: id, | ||
text: message, | ||
@@ -172,8 +210,8 @@ parse_mode: 'HTML', | ||
case "end": | ||
return _context5.stop(); | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee5, this); | ||
}, _callee6, this); | ||
})); | ||
function sendMenu(_x10, _x11, _x12) { | ||
function sendMenu(_x13, _x14, _x15) { | ||
return _sendMenu.apply(this, arguments); | ||
@@ -186,8 +224,8 @@ } | ||
value: function () { | ||
var _sendCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, message, menu) { | ||
return _regeneratorRuntime().wrap(function _callee6$(_context6) { | ||
var _sendCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id, message, menu) { | ||
return _regeneratorRuntime().wrap(function _callee7$(_context7) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
switch (_context7.prev = _context7.next) { | ||
case 0: | ||
return _context6.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), { | ||
return _context7.abrupt("return", this.client.post("".concat(this.endpoint, "/sendMessage"), { | ||
chat_id: id, | ||
@@ -202,8 +240,8 @@ text: message, | ||
case "end": | ||
return _context6.stop(); | ||
return _context7.stop(); | ||
} | ||
} | ||
}, _callee6, this); | ||
}, _callee7, this); | ||
})); | ||
function sendCallback(_x13, _x14, _x15) { | ||
function sendCallback(_x16, _x17, _x18) { | ||
return _sendCallback.apply(this, arguments); | ||
@@ -210,0 +248,0 @@ } |
{ | ||
"name": "@azteam/telegram-api", | ||
"version": "1.1.60", | ||
"version": "1.1.61", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -35,4 +35,5 @@ import HttpClient from '@azteam/http-client'; | ||
async sendInboxMessage(id, message, option = {}) { | ||
let text = message; | ||
if (Array.isArray(message)) { | ||
message = message.join('\n'); | ||
text = message.join('\n'); | ||
} | ||
@@ -42,3 +43,3 @@ | ||
chat_id: id, | ||
text: message, | ||
text, | ||
parse_mode: 'HTML', | ||
@@ -50,4 +51,5 @@ ...option, | ||
async sendReplyInboxMessage(id, replyID, message, option = {}) { | ||
let text = message; | ||
if (Array.isArray(message)) { | ||
message = message.join('\n'); | ||
text = message.join('\n'); | ||
} | ||
@@ -58,3 +60,3 @@ | ||
reply_to_message_id: replyID, | ||
text: message, | ||
text, | ||
parse_mode: 'HTML', | ||
@@ -65,2 +67,17 @@ ...option, | ||
async editMessage(id, messageId, message, option = {}) { | ||
let text = message; | ||
if (Array.isArray(message)) { | ||
text = message.join('\n'); | ||
} | ||
return this.client.post(`${this.endpoint}/editMessageText`, { | ||
chat_id: id, | ||
message_id: messageId, | ||
text, | ||
parse_mode: 'HTML', | ||
...option, | ||
}); | ||
} | ||
async sendMenu(id, message, menu) { | ||
@@ -67,0 +84,0 @@ return this.client.post(`${this.endpoint}/sendMessage`, { |
30780
494