Created
February 16, 2022 05:40
-
-
Save Chaspen/0e231f5bddedf876ef5075af0450c5ba to your computer and use it in GitHub Desktop.
awful horrible hacky piece of shit node.js script for sending out discord messages (user and message content) into a locally hosted REST api
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
const { json } = require("body-parser"); | |
const Eris = require("eris"); | |
var express = require('express'); | |
var app = express(); | |
var fs = require("fs"); | |
var usr | |
var cont | |
var msgRest; | |
const bot = new Eris("Bot YOUR_TOKEN_HERE"); | |
bot.on("ready", () => { | |
console.log("Bot started..."); | |
}); | |
bot.on("messageCreate", (msg) => { | |
usr = msg.author.username | |
message = msg.content | |
msgRest = `{"user":"${usr}", "content":"${message}"}`; | |
console.log(`<${usr}>: ${cont}`); | |
}); | |
bot.connect(); | |
app.get('/currentMessage', function (req, res) { | |
console.log(msgRest) | |
//console.log( data ); | |
//parsed = JSON.parse(msgRest) | |
res.end( msgRest ); | |
}); | |
var server = app.listen(5000, function () { | |
var host = server.address().address | |
var port = server.address().port | |
console.log("Channel scanner listening at http://%s:%s", host, port) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment