Commit 242f0d0e authored by Daniel Pérez Fernández's avatar Daniel Pérez Fernández 🕶
Browse files

Merge branch 'patch-1' into 'master'

Minor Fixed

See merge request !1
parents f5931e2d 9861fdc4
'use strict';
'use strict';
const app = require('../../settings/app');
......@@ -12,35 +12,35 @@ app.bot.onText(/^\@admin|^\@admins/, function(msg){
return;
}
const prop = {
'chat_id': msg.chat.id,
'from_id': msg.from.id,
'type_chat': msg.chat.type,
'fromName': msg.from.first_name,
'messageId': msg.message_id,
'replyId_messageId': msg.reply_to_message.message_id,
'username_chat': msg.chat.username,
'replyId': msg.reply_to_message.from.id,
'replyName': msg.reply_to_message.from.first_name,
'replyText': msg.reply_to_message.text,
'title': msg.chat.title
}
const prop = {};
prop.chat_id = msg.chat.id;
prop.from_id = msg.from.id;
prop.type_chat = msg.chat.type;
prop.fromName = msg.from.first_name;
prop.message_id = msg.message_id;
prop.reply_message_id = msg.reply_to_message.message_id;
prop.username_chat = msg.chat.username;
prop.replyIdUser = msg.reply_to_message.from.id;
prop.replyNameUser = msg.reply_to_message.from.first_name;
prop.replyTextUser = msg.reply_to_message.text;
prop.titleChat = msg.chat.title;
if (prop.type_chat == 'supergroup' && prop.username_chat != null) {
var deep_link = "https://t.me/" + prop.username_chat + "/" + prop.replyId_messageId;
var deep_link = "https://t.me/" + prop.username_chat + "/" + prop.reply_message_id;
}
else {
if (prop.type_chat == 'supergroup' && prop.username_chat == undefined) {
var info_chat_id = String(prop.chat_id); // Conversion to String
var mod_chat_id = info_chat_id.substring(4).trim(); // Removes -100 of the "chat_id" for create the Deep Link
var deep_link = String("tg://openmessage?chat_id=" + mod_chat_id + "&message_id=" + prop.replyId_messageId);
var deep_link_tgx = String("t.me" + mod_chat_id + "/" + prop.replyId_messageId);
var deep_link = String("tg://openmessage?chat_id=" + mod_chat_id + "&message_id=" + prop.reply_message_id);
var deep_link_tgx = String("t.me" + mod_chat_id + "/" + prop.reply_message_id);
}
}
app.bot.getChatMember(prop.chat_id, prop.from_id).then(function(infouser){
if (infouser.status == 'member'){
app.bot.deleteMessage(prop.chat_id, prop.messageId);
app.bot.deleteMessage(prop.chat_id, prop.message_id);
app.bot.sendMessage(prop.chat_id, app.i18n.__('Notifying administrators')).then(function(deletemessage){
setTimeout(function(){
app.bot.deleteMessage(prop.chat_id, deletemessage.message_id);
......@@ -49,14 +49,7 @@ app.bot.onText(/^\@admin|^\@admins/, function(msg){
app.bot.getChatAdministrators(prop.chat_id).then(function(adminsgroup){
const properties = {
'id': "",
'bot': "",
'name': "",
'alias': "",
'adminsinfo': "",
'opts': {parse_mode: 'Markdown'}
}
const properties = {};
for (var i = 0; i < adminsgroup.length; i++){
properties.adminsinfo = adminsgroup[i].user
......@@ -64,9 +57,10 @@ app.bot.onText(/^\@admin|^\@admins/, function(msg){
properties.bot = adminsgroup[i].user.is_bot
properties.name = adminsgroup[i].user.first_name
properties.alias = adminsgroup[i].user.username
properties.opts = {parse_mode: 'HTML'}
if (properties.bot == false){
app.bot.sendMessage(properties.adminsinfo.id, app.i18n.__('🛎 Alert: \n👨🏻‍💼 <b>Name:</b> ') + prop.fromName + "\n🆔 <b>Id:</b> <code>" + prop.from_id + app.i18n.__('</code>\n\n❌ <b>Offender:</b>\n🙅🏻‍♂️ <b>Name:</b> ') + prop.replyName + "\n🆔 <b>Id:</b> <code>" + prop.replyId + app.i18n.__('</code>\n📃 <b>Text with spam:</b> \n') + prop.replyText + app.i18n.__('\n\n🏛 <b>In the group:</b> ') + prop.title + "\n", {parse_mode: 'HTML', reply_markup:{ inline_keyboard: [[{text: app.i18n.__('Go to the message'), url: deep_link}],[{text: app.i18n.__('Tg X: Go to the message'), url: deep_link}]]}});
app.bot.sendMessage(properties.adminsinfo.id, app.i18n.__('🛎 Alert: \n👨🏻‍💼 <b>Name:</b> ') + prop.fromName + "\n🆔 <b>Id:</b> <code>" + prop.from_id + app.i18n.__('</code>\n\n❌ <b>Offender:</b>\n🙅🏻‍♂️ <b>Name:</b> ') + prop.replyNameUser + "\n🆔 <b>Id:</b> <code>" + prop.replyIdUser + app.i18n.__('</code>\n📃 <b>Text with spam:</b> \n') + prop.replyTextUser + app.i18n.__('\n\n🏛 <b>In the group:</b> ') + prop.titleChat + "\n", {parse_mode: 'HTML', reply_markup:{ inline_keyboard: [[{text: app.i18n.__('Go to the message'), url: deep_link}],[{text: app.i18n.__('Tg X: Go to the message'), url: deep_link}]]}});
}
}
})
......@@ -74,5 +68,4 @@ app.bot.onText(/^\@admin|^\@admins/, function(msg){
app.bot.sendMessage(prop.chat_id, app.i18n.__('This command is exclusive for users. Its function is to send alerts to the admins.'));
}
})
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment