Skip to content

Instantly share code, notes, and snippets.

@churchofthought
Created February 20, 2019 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save churchofthought/2b58e1692c87a97d83896c696e604622 to your computer and use it in GitHub Desktop.
Save churchofthought/2b58e1692c87a97d83896c696e604622 to your computer and use it in GitHub Desktop.
Euler Dynamo 3000
const Discord = require("discord.js")
const config = require("./config.json")
const fs = require("fs")
const timeout = ms => new Promise(res => setTimeout(res, ms))
const client = new Discord.Client({autoReconnect: true, sync: true});
(async () => {
await client.login(config.token)
const chan = client.channels.get("535534648814731284");
client.on('message', async message => {
if (message.member.user.id != "216437513709944832") return;
if (message.content) return;
const {embeds: [embed]} = message;
if (!embed) return;
if (!/Euler/.test(embed.author.name)) return;
const {title} = embed;
if (/Your inventory is full/.test(title)){
process.exit();
}
});
client.on('messageReactionAdd', async reaction => {
const message = reaction.message;
if (message.member.user.id != "216437513709944832") return;
if (message.content) return;
const {embeds: [embed]} = message;
if (!embed) return;
if (!/Euler/.test(embed.author.name)) return;
const [,creature] = embed.title.match(/^(.) Quick!/u) || [];
if (!creature) return;
if (creature == `${reaction.emoji}`){
await timeout(3000);
await message.react(creature);
}
})
for (;;){
chan.send(">>hunt");
chan.send(">>fish");
chan.send(">>forage");
await timeout(70000);
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment