diff --git a/CHANGELOG.md b/CHANGELOG.md index dee077c..0e0e606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## [Unreleased] +## 4.0.1 (2019-02-26) + +### Arreglado + +- Saludos a nuevos (ex)miembros + ## 4.0.0 (2019-02-23) ### Agregado diff --git a/package-lock.json b/package-lock.json index c16576c..29fe148 100644 --- a/package-lock.json +++ b/package-lock.json @@ -243,9 +243,9 @@ } }, "ajv": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.8.1.tgz", - "integrity": "sha512-eqxCp82P+JfqL683wwsL73XmFs1eG6qjw+RD3YHx+Jll1r0jNd4dh8QG9NYAeNGA/hnZjeEDgtTskgJULbxpWQ==", + "version": "6.9.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz", + "integrity": "sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg==", "requires": { "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", @@ -2986,6 +2986,37 @@ "dev": true, "requires": { "chalk": "^2.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, "log-update": { diff --git a/src/listen-commands/admin/index.js b/src/listen-commands/admin/index.js index 25bc95e..dfd2ab6 100644 --- a/src/listen-commands/admin/index.js +++ b/src/listen-commands/admin/index.js @@ -4,8 +4,12 @@ const { forwardMessage } = require('bot-api-overrides'); const verifyUrls = async (bot, msg) => { const chatId = msg.chat.id; const chatInfo = await bot.getChat(chatId); + const { + type, + all_members_are_administrators: allMembersAreAdministrators, + } = chatInfo; - if (chatInfo.type === 'group') { + if (['group', 'supergroup'].includes(type) && !allMembersAreAdministrators) { const urlEntities = msg.entities ? msg.entities.filter(entity => entity.type === 'url') : []; diff --git a/src/listen-commands/github/index.js b/src/listen-commands/github/index.js index 2c46df3..2d2d0c9 100644 --- a/src/listen-commands/github/index.js +++ b/src/listen-commands/github/index.js @@ -73,7 +73,7 @@ const verifyCode = async (bot, msg) => { const chatId = msg.chat.id; const chatInfo = await bot.getChat(chatId); - if (chatInfo.type === 'group') { + if (['supergroup', 'group'].includes(chatInfo.type)) { if (!Object.prototype.hasOwnProperty.call(msg, 'entities')) { return; } diff --git a/src/listen-commands/greetings/index.js b/src/listen-commands/greetings/index.js index 5858a5c..3469063 100644 --- a/src/listen-commands/greetings/index.js +++ b/src/listen-commands/greetings/index.js @@ -18,7 +18,11 @@ const formatName = (firstName, userName) => const sayHello = async (bot, msg) => { const chatId = msg.chat.id; const chatInfo = await bot.getChat(chatId); - if (chatInfo.type === 'group') { + const { + type, + all_members_are_administrators: allMembersAreAdministrators, + } = chatInfo; + if (['supergroup', 'group'].includes(type) && !allMembersAreAdministrators) { msg.new_chat_members.forEach(({ first_name, username }) => { const message = welcome.replace( '#{name}', @@ -41,7 +45,11 @@ const sayGoodbye = async (bot, msg) => { const chatId = msg.chat.id; const chatInfo = await bot.getChat(chatId); const { first_name: firstName, username } = msg.left_chat_member; - if (chatInfo.type === 'group') { + const { + type, + all_members_are_administrators: allMembersAreAdministrators, + } = chatInfo; + if (['supergroup', 'group'].includes(type) && !allMembersAreAdministrators) { sendMessage( bot, msg.chat.id,