• If you need help or want to discuss things, you now can also join us on our Discord Server!

DE Gast Move Script

2Insane4You

Member
Hei :D

Ich suche ein Script mit dem es möglich ist dem Bot mit einem Channel oder User Wunsch anzuschreiben (als Gast).
Der Bot sendet dann eine Nachricht an den Channel/ User und wenn die Anfrage für das Moven mit Ja oder ähnlich beantwortet wird, wird der Gast in den Channel gemoved.

Besteht ein solches Script schon?
Habe zurzeit leider nur wenig Zeit so etwas alleine zu programmieren da ich mich in die Commands etc. erst einlesen müsste.
Falls ein solches Script besteht könnte mir jemand eins zur Verfügung stellen?

Falls jemand Lust hat dieses Script zusammen zu Programmieren gerne per Pn melden.

Brauche dieses Script für einen etwas größeren Ts3...

Grüße René
 

DrWarpMan

Well-Known Member
Contributor
Insider
Daran wär ich auch interessiert 😎
Not sure if the requester has still interest in this, but if you do, can you say it in English please? I translated the request but I did not understand the first part :D Just write the what should the script do, in English instead :D
 

Montiary

Donor
is awesome!
Contributor
Daran wär ich auch interessiert 😎
Daran wär ich auch interessiert 😎
lade das auch in der release section hoch wo dann ein admin rüberschaut aber wer es direkt jetzt braucht
bitte schön ->

Code:
registerPlugin({
    name: 'Montys Move Request',
    version: '0.1.0',
    description: 'Move Request Test',
    author: 'Montary',
    vars: [
                {
                    name: 'ShowLog',
                    indent: 1,
                    title: 'Show Logs?',
                    type: 'select',
                    options: ['NO','YES']
                },
                {
                    name: 'MoveRequestPermissionGroupId',
                    indent: 1,
                    title: 'MoveRequestPermissionGroupId',
                    type: 'number'
                },{
                    name: "MsgRequest",
                    title: "MsgRequest placeholder : [clientname]",
                    indent: 1,
                    type: "string"
                },{
                    name: "MsgRequestFailed",
                    title: "MsgRequestFailed",
                    indent: 1,
                    type: "string"
                },{
                    name: "MsgRequestRefused",
                    title: "MsgRequestRefused",
                    indent: 1,
                    type: "string"
                },{
                    name: "MsgRequestSended",
                    title: "MsgRequestSended",
                    indent: 1,
                    type: "string"
                }
            ]
            
}, (_, config, meta) => {
    const engine = require('engine');
    const backend = require('backend');
    const store = require('store');
    const event = require('event');
    
    //setting var
    var MoveRequestPermissionGroupId = config.MoveRequestPermissionGroupId;
    var ShowLog = config.ShowLog;
    var MsgRequest = config.MsgRequest;
    var MsgRequestFailed = config.MsgRequestFailed;
    var MsgRequestSended = config.MsgRequestSended;
    var MsgRequestRefused = config.MsgRequestRefused;

    
    event.on('chat', function(ev) {
        
        var Message = ev.text;
        var Client = ev.client;
        var ClientGroups = Client.getServerGroups();
        if(Client.isSelf()){
            return;
        }
        for(var i = 0; i< ClientGroups.length;i++){           
                if(Message.includes("!switchto=")){
                    if(ClientGroups[i].id()==config.MoveRequestPermissionGroupId){
                        //right permission
                        if(ShowLog){engine.log("nickname = "+Message.substring(10,Message.length));}
                        var AskClient = backend.getClientByName(Message.substring(10,Message.length));
                        
                        if(AskClient === undefined){
                            Client.chat(MsgRequestFailed);
                            if(ShowLog){engine.log("Message send to "+Client.name()+" "+MsgRequestFailed);}
                            return;
                        }
                        if(ShowLog){engine.log(AskClient);}
                        store.set(AskClient.uid()+"MoveRequest",Client.uid());
                        Client.chat(MsgRequestSended);
                        if(ShowLog){engine.log("Message send to "+Client.name()+" "+MsgRequestSended);}
                        AskClient.chat(MsgRequest.replace("[clientname]",Client.name()));
                        if(ShowLog){engine.log("Message send to "+AskClient.name()+" "+MsgRequest);}
                        return;
                    }
                }
        }
        if(store.get(Client.uid()+"MoveRequest")!= 'undefined'){
            for(var i = 0; i< ClientGroups.length;i++){           
                if(Message == "yes"){
                    var ReqClient = backend.getClientByUniqueID(store.get(Client.uid()+"MoveRequest"));
                    var Channels = Client.getChannels();
                    ReqClient.moveTo(Channels[0].id());
                    if(ShowLog){engine.log("Switch Client "+ReqClient.name()+" to "+Channels[0].name());}
                    store.unset(Client.uid()+"MoveRequest");
                }else if(Message == "no"){
                    var ReqClient = backend.getClientByUniqueID(store.get(Client.uid()+"MoveRequest"));
                    ReqClient.chat(MsgRequestRefused);
                    store.unset(Client.uid()+"MoveRequest");
                    if(ShowLog){engine.log("Message send to "+ReqClient.name()+" "+MsgRequestRefused);}
                }
            }
        }
        
    });
});
 
Top