catto.js 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/TelegramChannel.js +19 -16
  2. package/package.json +1 -1
@@ -30,23 +30,22 @@ module.exports = class {
30
30
  if (data instanceof TelegramMessageBuilder) {
31
31
  data = data.data;
32
32
  }
33
- if (data.image) {
34
- await this.bot.client.telegram.sendPhoto(this.id, data.image, Object.assign({
35
- "caption": data.content,
36
- "show_caption_above_media": data.textAbove,
37
- "reply_parameters": data.replyParameters ? {
38
- "message_id": data.replyParameters.message.id,
39
- "chat_id": (data.replyParameters.channel ? data.replyParameters.channel.id : this.id),
40
- "allow_sending_without_reply": !1
41
- } : void 0,
42
- "reply_markup": data.replyMarkup ? data.replyMarkup : {
43
- "remove_keyboard": !0
33
+ if (data.media && data.media.length) {
34
+ await this.bot.client.telegram.sendMediaGroup(this.id, data.media.map((media, index) => {
35
+ if (index < 1) {
36
+ return {
37
+ "type": (media.type == "image") ? "photo" : media.type,
38
+ "media": media.url,
39
+ "caption": data.content,
40
+ "show_caption_above_media": data.textAbove
41
+ };
44
42
  }
45
- }, data.extra));
46
- } else if (data.video) {
47
- await this.bot.client.telegram.sendVideo(this.id, data.video, Object.assign({
48
- "caption": data.content,
49
- "show_caption_above_media": data.textAbove,
43
+ return {
44
+ "type": (media.type == "image") ? "photo" : media.type,
45
+ "media": media.url,
46
+ "show_caption_above_media": data.textAbove
47
+ };
48
+ }), Object.assign({
50
49
  "reply_parameters": data.replyParameters ? {
51
50
  "message_id": data.replyParameters.message.id,
52
51
  "chat_id": (data.replyParameters.channel ? data.replyParameters.channel.id : this.id),
@@ -98,3 +97,7 @@ module.exports = class {
98
97
 
99
98
  };
100
99
 
100
+
101
+
102
+
103
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {