Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registerPlugin({
- name: 'Event Channel Auto',
- version: '0.1',
- description: 'Event channel',
- author: 'Etsukazu Aoi <contact@aolkina.fr>',
- vars: {
- chcn: {
- title: 'Channel bot whose name will be changed',
- type: 'channel'
- },
- uuidadmin: {
- title: 'uuid admin bot',
- type: 'string',
- }
- }
- }, function(sinusbot, config) {
- var Title = null;
- var msgtemptretement = "";
- var status = 0;
- var neededClient = 0;
- var channelpassworld;
- var compteur = false;
- var badraison = new Array();
- var badusers = new Array();
- var badname = new Array();
- var SuffixTitle;
- var Slot;
- var TopicChannel;
- var Regle;
- badusers = sinusbot.getVarGlobal("Event_BadUsersUid");
- badraison = sinusbot.getVarGlobal("Event_BadUsersRaison");
- badname = sinusbot.getVarGlobal("Event_BadUsersName");
- SuffixTitle = sinusbot.getVarInstance("Event_Suffix");
- Slot = sinusbot.getVarInstance("Event_Slot");
- TopicChannel = sinusbot.getVarInstance("Event_Topic");
- Regle = sinusbot.getVarInstance("Event_Regle");
- if(SuffixTitle == null) {
- SuffixTitle = "Default Suffix";
- sinusbot.setVarInstance("Event_Suffix",SuffixTitle);
- }
- if(Slot == null) {
- Slot = 8;
- sinusbot.setVarInstance("Event_Slot",Slot);
- }
- if(TopicChannel == null) {
- TopicChannel = "";
- sinusbot.setVarInstance("Event_Topic",TopicChannel);
- }
- if(Regle == null) {
- Regle = "Default Regle";
- sinusbot.setVarInstance("Event_Regle",Regle);
- }
- sinusbot.log("----");
- sinusbot.log("Badusers: "+badusers);
- sinusbot.log("badraison: "+badraison);
- sinusbot.log("Suffix: "+SuffixTitle);
- sinusbot.log("Slot: "+Slot);
- sinusbot.log("Topic: "+TopicChannel);
- sinusbot.log("Regle: "+Regle);
- sinusbot.log("----");
- var admin = config.uuidadmin.split(',');
- function code_generate()
- {
- var characters = "abcdefghijklmopqrstuvwxyz1234567890ABCDEFHIJKLMNOPQRSTUSVWXYZ¥¥¥¥¥";
- var CodeIs = '';
- for (var p = 0; p < 12; p++)
- {
- CodeIs = CodeIs + characters[(Math.floor((Math.random() * characters.length)))];
- }
- return CodeIs;
- }
- sinusbot.on('chat', function(ev) {
- var msgt = ev.msg.split(',');
- sinusbot.log(ev.clientId);
- if (admin.indexOf(ev.clientUid) >= 0) {
- if(msgt[0] == "!name") {
- SuffixTitle = msgt[1];
- sinusbot.setVarInstance("Event_Suffix",SuffixTitle);
- }else if(msgt[0] == "!slot") {
- Slot = parseInt(msgt[1]);
- sinusbot.setVarInstance("Event_Slot",Slot);
- }else if(msgt[0] == "!topic") {
- TopicChannel = msgt[1];
- sinusbot.setVarInstance("Event_Topic",TopicChannel);
- sinusbot.log(TopicChannel);
- }else if(msgt[0] == "!Regle") {
- Regle = msgt[1];
- sinusbot.setVarInstance("Event_Regle",Regle);
- }else if(msgt[0] == "!udc") {
- if(status == 100) {
- Title = 'Fermer | '+ SuffixTitle;
- }else {
- if(compteur == true){
- Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
- }else {
- Title = SuffixTitle;
- }
- }
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title , topic: TopicChannel});
- }else if(msgt[0] == "!lock") {
- status = 100;
- Title = 'Fermer | '+ SuffixTitle;
- if(msgt[2] == null){
- channelpassworld = code_generate();
- }else{
- channelpassworld = msgt[2];
- }
- sinusbot.log(channelpassworld);
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: channelpassworld });
- sinusbot.chatChannel("[color=#aa0000][b]Le channel est désormais fermé au public");
- if(msgt[1] == "y"){
- sinusbot.chatChannel('Mot de pass du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
- }else{
- sinusbot.chatPrivate(ev.clientId,'Mot de passe du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
- }
- }else if(msgt[0] == "!unlock") {
- status = 1;
- if(compteur == true){
- Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
- }else {
- Title = SuffixTitle;
- }
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
- sinusbot.chatChannel("[color=#007700][b]channel ouvert à tout le monde");
- }else if(msgt[0] == "!count"){
- if(msgt[1] == "true"){
- compteur = true;
- }else if(msgt[1] == "false"){
- compteur = false;
- }
- }else if(msgt[0] == "!reset") {
- status = 0;
- Title = 'Preparation | '+ SuffixTitle;
- sinusbot.chatChannel('Default Mot de Passe du channel ->[b][color=#ff007f] lock [/color][/b]');
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: 'lock'});
- sinusbot.chatChannel('Preparation en cours du Channel');
- }else if(msgt[0] == "!pret") {
- status = 1;
- if(compteur == true){
- Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
- }else {
- Title = SuffixTitle;
- }
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
- }else if(msgt[0] == "!badadd"){
- badusers.push(msgt[1]);
- sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
- var raisonk = "On t'aime pas, va voir ailleurs si on y est";
- if(msgt[2] != null){
- var raisonk = msgt[2];
- }
- badraison.push(raisonk);
- sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
- }else if(msgt[0] == "!baddel"){
- var index = badusers.indexOf(msgt[1]);
- if (index > -1) {
- badusers.splice(index, 1);
- badraison.splice(index, 1);
- }
- sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
- sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
- }else if(msgt[0] == "!badlist") {
- for(var a = 0 ; a < badusers.length ; a++){
- msgtemptretement = msgtemptretement + 'UId: [color=#ff007f][b]' + badusers[a] + '[/b][/color] Raison: [color=#ff007f][b]' + badraison[a] + '[b][/color][b] | [/b]';
- sinusbot.log(badusers[a] + " " + badraison[a]);
- }
- sinusbot.chatChannel(msgtemptretement);
- sinusbot.log(msgtemptretement);
- msgtemptretement = "";
- }else if(msgt[0] == "!help") {
- sinusbot.chatPrivate(ev.clientId,"!name,nom_du_channel || !slot,nombre_de_slot || !topic,topic_du_channel || !udc");
- sinusbot.chatPrivate(ev.clientId,"!badadd,id_personne || !baddel,id_personne || !badl,id_de_tout_les_bloquer");
- sinusbot.chatPrivate(ev.clientId,"!lock,y*,mdp* || !unlock");
- sinusbot.chatPrivate(ev.clientId,"* = optionele");
- }else if(msgt[0] == "!badreset") {
- badusers = new Array();
- badraison = new Array();
- sinusbot.setVarGlobal("Event_BadUsersUid",badusers);
- sinusbot.setVarGlobal("Event_BadUsersRaison",badraison);
- sinusbot.chatPrivate(ev.clientId,"badusers: " + badusers + " | badraison: " + badraison);
- }else if(msgt[0] == "!mute") {
- if(msgt[1] == "true") {
- sinusbot.setMute(true);
- }else if(msgt[1] == "false") {
- sinusbot.setMute(false);
- }
- }
- // }else if(ev.msg.startsWith('!'){
- // 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");
- }
- });
- sinusbot.on('clientMove', function(ev) {
- if(ev.newChannel == config.chcn){
- for(var a = 0 ; a < badusers.length ; a++){
- if(ev.clientUid == badusers[a]){
- sinusbot.kickChannel(ev.clientId, badraison[a] );
- }
- }
- }
- });
- sinusbot.on('clientCount', function(ev) {
- neededClient = ev.count-1;
- if(status == 0){
- Title = 'Preparation | '+ SuffixTitle;
- sinusbot.channelUpdate(parseInt(config.chcn),{ name: Title, password: 'lock'});
- }else if(status == 1){
- if(neededClient >= Slot){
- Title = 'Complet | '+ SuffixTitle;
- channelpassworld = code_generate();
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: channelpassworld});
- sinusbot.chatChannel('Mot de pass du channel ->[b][color=#ff007f] '+channelpassworld+' [/color][/b] !');
- status = 5;
- }else{
- if(compteur == true){
- Title = String(neededClient) +'/'+ Slot +' | '+ SuffixTitle;
- if (Title.length > 40) {
- Title = Title.substring(0,40);
- }
- sinusbot.channelUpdate(parseInt(config.chcn, 10),{ name: Title, password: ''});
- }else {
- Title = SuffixTitle;
- }
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement