Skip to content

Instantly share code, notes, and snippets.

@ajkachnic
Last active February 2, 2021 18:37
Show Gist options
  • Save ajkachnic/c24f10224ceb9ad09cf35103613b8f88 to your computer and use it in GitHub Desktop.
Save ajkachnic/c24f10224ceb9ad09cf35103613b8f88 to your computer and use it in GitHub Desktop.
Script to chat on repl logs
const fetch = require('node-fetch')
const prompt = require('prompt-sync')()
const chalk = require('chalk')
const nick = "@andrew"
const markdown = msg => {
const bold = /\*\*(.*)\*\*/gim
const strikethrough = /\~\~(.*)\~\~/gim
const italics = /\*(.*)\*/gim
return msg
.replace(bold, '$1')
.replace(italics, '$1')
.replace(strikethrough, '$1')
.trim()
}
const ask = async () => {
const text = markdown(prompt('>> '))
if(text === null) process.exit(1)
const message = chalk.bold(nick) + `: ${chalk.dim(text)}`
const url = `https://blog.repl.it/${encodeURIComponent(message)}`
await fetch(url)
ask()
}
@seisvelas
Copy link

The internet is wonderful. People are wonderful.

@web3cryptowallet
Copy link

Cool idea. I remember the early days of the internet, when my admin friend monitored PHP logs manually 24/7 and hackers trolled him with random porn links and fakes bugs in the HTTP REQ hahah

@MoElaSec
Copy link

MoElaSec commented Feb 2, 2021

well things escalated quickly 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment