Skip to content

Instantly share code, notes, and snippets.

@Bioblaze
Created January 25, 2017 07:00
Show Gist options
  • Save Bioblaze/26a1ba885ff02cecb4e29274e4adccc2 to your computer and use it in GitHub Desktop.
Save Bioblaze/26a1ba885ff02cecb4e29274e4adccc2 to your computer and use it in GitHub Desktop.
Proxy for Discord.io
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