-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.js
74 lines (46 loc) · 1.15 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var config = require( "./config" );
//
// Connection Handler
//
bot.on( "Connected", function() {
this.setStatus( "Online" );
this.setChat( config.Group );
} );
//
// Default Commands
//
bot.registerCommand( "update", function( name, steamID ) {
if ( bot.isAdmin( steamID ) )
process.exit( 1 );
} );
//
// CLI Output
//
function print( str ) {
console.log( str.replace( /[\x00-\x09]/g, "" ) );
}
bot.on( "Connected", function() {
print( "Connected." );
} );
bot.on( "Disconnected", function() {
print( "Lost Connection." );
} );
bot.on( "Message", function( name, steamID, msg ) {
print( name + ": " + msg );
} );
bot.on( "UserConnected", function( name, steamID ) {
print( name + " (" + steamID + ") connected." );
} );
bot.on( "UserDisconnected", function( name, steamID ) {
print( name + " (" + steamID + ") disconnected." );
} );
bot.on( "UserKicked", function( target, _, actor ) {
print( target + " was kicked by " + actor + "." );
} );
bot.on( "UserBanned", function( target, _, actor ) {
print( target + " was banned by " + actor + "." );
} );
//
// Init connection!
//
bot.connect( config.User, config.Pass ); // Here we go!