-
-
Save RaptorRobokun/2c3eeaf0e4f6f38871b90eba9e6d710a 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