Send a message to the server or pm a player
Broadcast a message, if a playerID is provided; send a PM
var Daystodiewebapi = require('machinepack-7daystodiewebapi');
// Send a message to the server or pm a player
Daystodiewebapi.sendMessage({
ip: '192.168.0.1',
port: '8082',
authName: 'csmm',
authToken: 'EOGHZANOIZEAHZFUR93573298539242F3NG',
message: 'Hello world',
playerID: '76561198028175841',
}).exec({
// An unexpected error occurred.
error: function (error) {
},
// Server refused the request (usually means server offline)
connectionRefused: function () {
},
// Not authorized to do this request
unauthorized: function () {
},
// The given player id is not valid
unknownPlayer: function () {
},
// OK.
success: function () {
},
});
IP of the server to send a request to
'192.168.0.1'
Port of the server to send a request.
'8082'
Authorization name to send with the request
'csmm'
Authorization token to send with the request
'EOGHZANOIZEAHZFUR93573298539242F3NG'
Message to send
'Hello world'
Entity ID of the player to kick
'76561198028175841'
An unexpected error occurred.
Server refused the request (usually means server offline)
Not authorized to do this request
The given player id is not valid
OK.