Skip to content

Instantly share code, notes, and snippets.

@PROPHESSOR
Created March 24, 2019 16:21
Show Gist options
  • Save PROPHESSOR/7317d5122c4492f217df340484a8fef0 to your computer and use it in GitHub Desktop.
Save PROPHESSOR/7317d5122c4492f217df340484a8fef0 to your computer and use it in GitHub Desktop.
ASCII Doom Test Bot https://discord.gg/dUJBrGk
const DiscordJS = require('discord.js');
const bot = new DiscordJS.Client();
const token = 'PUT_YOUR_TOKEN_HERE';
const cp = require('child_process');
const ID_SERVER = 'PUT_YOUR_SERVER_ID_HERE';
const ID_CHANNEL = 'PUT_YOUR_TEXT_CHANNEL_ID_HERE';
const ID_MESSAGE = 'PUT_YOUR_MESSAGE_ID_HERE';
const magic = (msg) => {
const proc = cp.spawn('prboom-plus', ['-iwad', '/home/prophessor/.doomseeker/doom2.wad']);
proc.stdout.on('data', chunk => {
msg.edit('```' + chunk.toString().replace(/\x1b.+?m/g, '').slice(0, 1990) + '```');
// console.log('```' + chunk.toString().replace(/\x1b.+?m/g, '').slice(0, 1990) + '```');
})
}
bot.on('ready', () => {
console.log(`Logged in as ${bot.user.tag}!`);
bot.guilds.get(ID_SERVER).channels.get(ID_CHANNEL).fetchMessage(ID_MESSAGE)
.then(msg => magic(msg));
});
bot.login(token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment