registerPlugin({
name: 'Ip Finder',
version: '0.1',
description: 'Odaya giden kullanıcının ismini ve ip adresini size gönderir',
author: '! Arda <[EMAIL][email protected][/EMAIL]>',
requiredModules: ['http'],
vars:[{
name: 'guestGroup',
title: 'Guest Group',
type: 'strings'
},
{
name: 'channel',
title: 'Channel',
type: 'channel'
},
{
name: 'channel2',
title: 'Channel 2',
type: 'channel'
},
{
name: 'alertGroups',
title: 'Admin Groups',
type: 'strings'
},
{
name: 'messageType',
title: 'Should the Bot send a privat chat message or poke the users?',
type: 'select',
options: [
'PM',
'Poke'
]
}
]
}, function(sinusbot, config) {
var engine = require('engine');
var backend = require('backend');
var event = require('event');
var http = require('http');
event.on('clientMove', function(ev) {
if (ev.client.isSelf()) {
return;
}
if (ev.toChannel){
if (ev.toChannel.id() == config.channel){
if (checkIfInNoServerGroup(ev.client, config.guestGroup)){
var clients = backend.getClients();
clients.forEach(function(client) {
alertClient(client, config.alertGroups, ev.client);
});
}
}
}
});
event.on('clientMove', function(ev) {
if (ev.client.isSelf()) {
return;
}
if (ev.toChannel){
if (ev.toChannel.id() == config.channel2){
if (checkIfInNoServerGroup(ev.client, config.guestGroup)){
var clients = backend.getClients();
clients.forEach(function(client) {
alertClient2(client, config.alertGroups, ev.client);
});
}
}
}
});
function alertClient(client, alertGroups, newClient){
const ipt = newClient.getIPAddress('T');
var serverGroups = client.getServerGroups();
for (var serverGroup in serverGroups){
for (var listenGroup in alertGroups){
if (serverGroups[serverGroup].id() == alertGroups[listenGroup]){
if (config.messageType == 0){
client.chat("Name : " +newClient.name()+ " IP : " +newClient.getIPAddress('T')+ ' Otomatik olarak serverdan T takımına atıldı.');
sinusbot.http({
method: 'POST',
url: '[URL]https://panel.csduragi.com/doLogin[/URL]',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: '{"email": "", "sifre": ""}'
});
}
return;
}
}
}
}
function alertClient2(client, alertGroups, newClient){
var serverGroups = client.getServerGroups();
for (var serverGroup in serverGroups){
for (var listenGroup in alertGroups){
if (serverGroups[serverGroup].id() == alertGroups[listenGroup]){
if (config.messageType == 0){
client.chat("Name : " +newClient.name()+ " IP : " +newClient.getIPAddress('CT')+ ' Otomatik olarak serverdan CT takımına atıldı.');
}
return;
}
}
}
}
function checkIfInNoServerGroup(client, guestGroup){
var serverGroups = client.getServerGroups();
for (var serverGroup in serverGroups){
if (serverGroups[serverGroup].id() != guestGroup){
return false;
}else{
return true;
}
}
return true;
}
});