Created
January 25, 2017 07:00
-
-
Save Bioblaze/26a1ba885ff02cecb4e29274e4adccc2 to your computer and use it in GitHub Desktop.
Proxy for Discord.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Debug = require('winston'); // logging all Errors | |
Debug.configure({ | |
transports: [ | |
new (Debug.transports.Console)(), | |
new (Debug.transports.File)({ filename: 'Debug.log' }) | |
] | |
}); | |
var DiscordProxy = { | |
addClient: function(client) { | |
this.client = client; | |
}, | |
log: function(type, message, object) { | |
var date = new Date(); | |
object.timestamp = date; | |
Debug.log(type, message, object); | |
}, | |
sendMessage: function(id, message) { | |
if (!this.client) { | |
console.log("No Client Found"); | |
} else { | |
console.log("Sending Message"); | |
this.log('Info', "Message send to Discord Proxy from Plugin!", {}); | |
this.client.sendMessage({ | |
to: id, | |
message: message | |
}); | |
} | |
} | |
} | |
module.exports = DiscordProxy; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment