Skip to content

Instantly share code, notes, and snippets.

@xetrics
Created May 7, 2017 19:24
Show Gist options
  • Save xetrics/1565d9ba28e1b429f10da152455bae8d to your computer and use it in GitHub Desktop.
Save xetrics/1565d9ba28e1b429f10da152455bae8d to your computer and use it in GitHub Desktop.
discord image bomb
const Discord = require("discord.js")
const fs = require("fs")
const path = require("path")
if(process.argv.length <= 3) {
console.log(`Usage: ${__filename} DISCORD_TOKEN /path/to/shibes`)
return
}
const bot = new Discord.Client()
bot.login(process.argv[2])
bot.on("ready", () => {
console.log("ready ;333333333")
})
bot.on("message", (msg) => {
if(msg.author.id != bot.user.id || !msg.content.startsWith("!shibastrike") || msg.mentions.users.size < 1) return
msg.delete()
fs.readdirSync(process.argv[3]).forEach((file) => {
if(!fs.statSync(path.join(process.argv[3], file)).isFile()) return
msg.mentions.users.first().send("", {
file: path.join(process.argv[3], file)
})
})
})
{
"name": "shibastrike",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^11.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment