• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

DE frage

DrWarpMan

Well-Known Member
Contributor
Insider
Client is not defined can mean for ex. that the client you get there is not existing probably.
If you could share us the whole code, that would be helpful.

Example:

JavaScript:
let client = backend.getClientByUniqueID("dq56q5");
client.chat("Hi!"); // Would not work, because the client with ID dq56q5 does not exist and could not either
 
Code:
registerPlugin({
 name: 'message',
 version: '1.0.0',
 description: 'Sobald den Bot eine Nachricht geschrebn wird, antwortet er dir mit eeiner Personalisierten Nachricht.',
 author: 'Lixqa',
vars:[
    {
        name: 'messages',
        title: 'Nachrichten hinzufügen',
        type: 'array',
        vars:[
            {
                name: 'group',
                description: 'Die Gruppe, die Akzeptiert werden soll.',
                placeholder: '23283',
                type:'string'
            },
            {
                name: 'command',
                description: 'Befehl, bei den eine Nachricht zurück gesendet werden soll.',
                placeholder: '!test',
                type:'string'
            },
            {
                name: 'answer',
                description: 'die Nachricht, die der Bot zurückschreibt',
                placeholder: 'dies ist die antwort auf "!test"',
                type: 'multiline'
            }
        ]
    }
]

}, function(sinusbot, config) {
    var engine = require('engine');
    var backend = require('backend');
    var event = require('event');
    
    event.on('chat', function(ev) {
            if(client.send.messages)
                if (messages.config.command);
                ev.client.chat(config.answer)
    

    });
});
 

DrWarpMan

Well-Known Member
Contributor
Insider
What should client.send.messages do?
If I get it correct, you already have the event when the client sends a message, you just have to check if it is not the bot iself
if(ev.client.isSelf() === false)

And I do not have the time to explain the second thing with the messages.config.. sorry.
 
Top