Advertisement
Etsukazu_Aoi

Untitled

Jan 5th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. registerPlugin({
  2.     name: 'Event Channel Auto',
  3.     version: '0.1',
  4.     description: 'Event channel',
  5.     author: 'Etsukazu Aoi <contact@aolkina.fr>',
  6.     vars: {
  7.         chcn: {
  8.             title: 'Channel bot whose name will be changed',
  9.             type: 'channel'
  10.         },
  11.         uuidadmin: {
  12.             title: 'uuid admin bot',
  13.             type: 'string',
  14.         }
  15.     }
  16. }, function(sinusbot, config) {
  17.     var Title = null;
  18.     var msgtemptretement = "";
  19.     var status = 0;
  20.     var neededClient = 0;
  21.     var channelpassworld;
  22.     var compteur = false;
  23.     var badraison = new Array();
  24.     var badusers = new Array();
  25.     var badname = new Array();
  26.     var SuffixTitle;
  27.     var Slot;
  28.     var TopicChannel;
  29.     var Regle;
  30.    
  31.     badusers = sinusbot.getVarGlobal("Event_BadUsersUid");
  32.     badraison = sinusbot.getVarGlobal("Event_BadUsersRaison");
  33.     badname = sinusbot.getVarGlobal("Event_BadUsersName");
  34.    
  35.     SuffixTitle = sinusbot.getVarInstance("Event_Suffix");
  36.     Slot = sinusbot.getVarInstance("Event_Slot");
  37.     TopicChannel = sinusbot.getVarInstance("Event_Topic");
  38.     Regle = sinusbot.getVarInstance("Event_Regle");
  39.    
  40.     if(SuffixTitle == null) {
  41.         SuffixTitle = "Default Suffix";
  42.         sinusbot.setVarInstance("Event_Suffix",SuffixTitle);
  43.     }
  44.     if(Slot == null) {
  45.         Slot = 8;
  46.         sinusbot.setVarInstance("Event_Slot",Slot);
  47.     }
  48.     if(TopicChannel == null) {
  49.         TopicChannel = "";
  50.         sinusbot.setVarInstance("Event_Topic",TopicChannel);
  51.     }
  52.     if(Regle == null) {
  53.         Regle = "Default Regle";
  54.         sinusbot.setVarInstance("Event_Regle",Regle);
  55.     }
  56.    
  57.     sinusbot.log("----");
  58.     sinusbot.log("Badusers: "+badusers);
  59.     sinusbot.log("badraison: "+badraison);
  60.     sinusbot.log("Suffix: "+SuffixTitle);
  61.     sinusbot.log("Slot: "+Slot);
  62.     sinusbot.log("Topic: "+TopicChannel);
  63.     sinusbot.log("Regle: "+Regle);
  64.     sinusbot.log("----");
  65.    
  66.     var admin = config.uuidadmin.split(',');
  67.    
  68.     function code_generate()
  69.     {
  70.         var characters = "abcdefghijklmopqrstuvwxyz1234567890ABCDEFHIJKLMNOPQRSTUSVWXYZ¥¥¥¥¥";
  71.         var CodeIs = '';
  72.         for (var p = 0; p < 12; p++)
  73.         {
  74.            CodeIs = CodeIs + characters[(Math.floor((Math.random() * characters.length)))];
  75.         }
  76.         return CodeIs;
  77.     }
  78.  
  79.     sinusbot.on('chat', function(ev) {
  80.             var msgt = ev.msg.split(',');
  81.             sinusbot.log(ev.clientId);
  82.            
  83.             if (admin.indexOf(ev.clientUid) >= 0) {
  84.                 if(msgt[0] == "!name") {   
  85.                     SuffixTitle = msgt[1];
  86.                     sinusbot.setVarInstance("Event_Suffix",SuffixTitle);
  87.                 }else if(msgt[0] == "!slot") {
  88.                     Slot = parseInt(msgt[1]);
  89.                     sinusbot.setVarInstance("Event_Slot",Slot);
  90.                 }else if(msgt[0] == "!topic") {
  91.                     TopicChannel = msgt[1];
  92.                     sinusbot.setVarInstance("Event_Topic",TopicChannel);
  93.                     sinusbot.log(TopicChannel);
  94.                 }else if(msgt[0] == "!Regle") {
  95.                     Regle = msgt[1];
  96.                     sinusbot.setVarInstance("Event_Regle",Regle);
  97.                 }else if(msgt[0] == "!udc") {
  98.                    
  99.                     if(status == 100) {
  100.                         Title = 'Fermer | '+ SuffixTitle;
  101.                     }else {
  102.                         if(compteur == true){
  103.                             Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
  104.                         }else {
  105.                             Title = SuffixTitle;
  106.                         }
  107.                     }
  108.                     if (Title.length > 40) {
  109.                         Title = Title.substring(0,40);
  110.                     }
  111.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title , topic: TopicChannel});
  112.                    
  113.                 }else if(msgt[0] == "!lock") {
  114.                    
  115.                     status = 100;
  116.                     Title = 'Fermer | '+ SuffixTitle;
  117.                     if(msgt[2] == null){
  118.                         channelpassworld = code_generate();
  119.                     }else{
  120.                         channelpassworld = msgt[2];
  121.                     }
  122.                     sinusbot.log(channelpassworld);
  123.                     if (Title.length > 40) {
  124.                         Title = Title.substring(0,40);
  125.                     }
  126.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: channelpassworld });
  127.                     sinusbot.chatChannel("[color=#aa0000][b]Le channel est désormais fermé au public");
  128.                     if(msgt[1] == "y"){
  129.                         sinusbot.chatChannel('Mot de pass du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
  130.                     }else{
  131.                         sinusbot.chatPrivate(ev.clientId,'Mot de passe du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
  132.                     }
  133.                    
  134.                 }else if(msgt[0] == "!unlock") {
  135.                     status = 1;
  136.                     if(compteur == true){
  137.                         Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
  138.                     }else {
  139.                         Title = SuffixTitle;
  140.                     }
  141.                     if (Title.length > 40) {
  142.                         Title = Title.substring(0,40);
  143.                     }
  144.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
  145.                     sinusbot.chatChannel("[color=#007700][b]channel ouvert à tout le monde");
  146.                 }else if(msgt[0] == "!count"){
  147.                     if(msgt[1] == "true"){
  148.                         compteur = true;
  149.                     }else if(msgt[1] == "false"){
  150.                         compteur = false;
  151.                     }
  152.                 }else if(msgt[0] == "!reset") {
  153.                     status = 0;
  154.                     Title = 'Preparation | '+ SuffixTitle;
  155.                     sinusbot.chatChannel('Default Mot de Passe du channel ->[b][color=#ff007f] lock [/color][/b]');
  156.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: 'lock'});
  157.                     sinusbot.chatChannel('Preparation en cours du Channel');
  158.                 }else if(msgt[0] == "!pret") {
  159.                     status = 1;
  160.                     if(compteur == true){
  161.                         Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
  162.                     }else {
  163.                         Title = SuffixTitle;
  164.                     }
  165.                     if (Title.length > 40) {
  166.                         Title = Title.substring(0,40);
  167.                     }
  168.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
  169.                 }else if(msgt[0] == "!badadd"){
  170.                     badusers.push(msgt[1]);
  171.                     sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
  172.  
  173.                     var raisonk = "On t'aime pas, va voir ailleurs si on y est";
  174.                     if(msgt[2] != null){
  175.                         var raisonk = msgt[2];
  176.                     }
  177.                     badraison.push(raisonk);
  178.                     sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
  179.                 }else if(msgt[0] == "!baddel"){
  180.                     var index = badusers.indexOf(msgt[1]);
  181.                     if (index > -1) {
  182.                         badusers.splice(index, 1);
  183.                         badraison.splice(index, 1);
  184.                     }
  185.                     sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
  186.                     sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
  187.                 }else if(msgt[0] == "!badlist") {
  188.                     for(var a = 0 ; a < badusers.length ; a++){
  189.                     msgtemptretement = msgtemptretement + 'UId: [color=#ff007f][b]' + badusers[a] + '[/b][/color] Raison: [color=#ff007f][b]' + badraison[a] + '[b][/color][b] | [/b]';
  190.                         sinusbot.log(badusers[a] + " " + badraison[a]);
  191.                     }
  192.                     sinusbot.chatChannel(msgtemptretement);
  193.                     sinusbot.log(msgtemptretement);
  194.                     msgtemptretement = "";
  195.                 }else if(msgt[0] == "!help") {
  196.                     sinusbot.chatPrivate(ev.clientId,"!name,nom_du_channel || !slot,nombre_de_slot || !topic,topic_du_channel || !udc");
  197.                     sinusbot.chatPrivate(ev.clientId,"!badadd,id_personne || !baddel,id_personne || !badl,id_de_tout_les_bloquer");
  198.                     sinusbot.chatPrivate(ev.clientId,"!lock,y*,mdp* || !unlock");
  199.                     sinusbot.chatPrivate(ev.clientId,"* = optionele");
  200.                 }else if(msgt[0] == "!badreset") {
  201.                     badusers = new Array();
  202.                     badraison = new Array();
  203.                     sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
  204.                     sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
  205.                     sinusbot.chatPrivate(ev.clientId,"badusers: " + badusers + " | badraison: " + badraison);
  206.                 }else if(msgt[0] == "!mute") {
  207.                     if(msgt[1] == "true") {
  208.                         sinusbot.setMute(true);
  209.                     }else if(msgt[1] == "false") {
  210.                         sinusbot.setMute(false);
  211.                     }
  212.                 }
  213.             // }else if(ev.msg.startsWith('!'){
  214.                 // sinusbot.chatPrivate(ev.clientId,"Vous n\'avais pas la permission merci de contactez [URL=client://2/6YuaP22M36u9/f1Vl83hwoP/KUw=~Etsukazu_Aoi 「悦和」。]Etsukazu_Aoi 「悦和」。[/URL] ou par email contact@aolkina.fr");
  215.             }
  216.     });
  217.    
  218.     sinusbot.on('clientMove', function(ev) {
  219.         if(ev.newChannel == config.chcn){
  220.             for(var a = 0 ; a < badusers.length ; a++){
  221.                 if(ev.clientUid == badusers[a]){
  222.                     sinusbot.kickChannel(ev.clientId, badraison[a] );
  223.                 }
  224.             }
  225.        
  226.         }
  227.        
  228.     });
  229.    
  230.     sinusbot.on('clientCount', function(ev) {
  231.         neededClient = ev.count-1;
  232.        
  233.         if(status == 0){
  234.             Title = 'Preparation | '+ SuffixTitle;
  235.             sinusbot.channelUpdate(parseInt(config.chcn),{ name: Title, password: 'lock'});
  236.         }else if(status == 1){
  237.             if(neededClient >= Slot){
  238.                 Title = 'Complet | '+ SuffixTitle;
  239.                 channelpassworld = code_generate();
  240.                 if (Title.length > 40) {
  241.                     Title = Title.substring(0,40);
  242.                 }
  243.                 sinusbot.channelUpdate(parseInt(config.chcn, 10),{  name: Title, password: channelpassworld});
  244.                 sinusbot.chatChannel('Mot de pass du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
  245.                 status = 5;
  246.             }else{
  247.                 if(compteur == true){
  248.                     Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
  249.                     if (Title.length > 40) {
  250.                         Title = Title.substring(0,40);
  251.                     }
  252.                     sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
  253.                 }else {
  254.                     Title = SuffixTitle;
  255.                 }
  256.             }
  257.         }
  258.     });
  259.    
  260. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement