fun/ham facts support, new sfx

This commit is contained in:
Chris Ham
2018-01-22 17:06:12 -08:00
parent fc5b8604b8
commit 8514847526
25 changed files with 1139 additions and 0 deletions

1050
conf/funfacts Executable file

File diff suppressed because it is too large Load Diff

10
conf/hamfacts Executable file
View File

@@ -0,0 +1,10 @@
As of 2012, there were 13,564 people in the U.S. listed on whitepages.com with the last name 'Ham'.
A country ham is a dry-cured ham. The ham is hand rubbed with salt, sugar and nitrate; packed in the curing ingredients and usually smoked.
A country ham is much drier than injected-cured hams and has a sharper flavored due to its high salt content.
Picnic Ham is a cut of pork from the upper part of the foreleg and includes a portion of the shoulder. By definition, it is not a true ham (Ham is cut from the hind leg). However, the Picnic Ham is cured in the same manner as ham, giving it a ham-like flavor.
Ham fanatics prefer hams made from the left leg of a pig. A pig scratches itself with its right leg, which uses the muscles more often, making the meat tougher.
The Hormel Company of Austin, Minnesota sold the first canned ham in 1926.
Chicago artist Dwight Kalb made a statue of Madonna from 180 pounds of ham.
A ham is the rear leg of a hog, usually preserved by salting, smoking or drying, or a combination of these methods. Fresh hams are also available. In the U.S. pork shoulders are frequently processed into hams and marketed as picnic hams, shoulder hams, etc.
Ham is one of the oldest meats of civilized man, although Larousse Gastronomique claims that the salting and smoking of pork to produce ham is a French invention.
Mainz ham is a German ham that is brined, soaked in brandy or wine lees (or a mixture of both) and then smoked for a long period.

79
main.js
View File

@@ -24,6 +24,26 @@ fs.watch(sfxFilePath, (eventType, filename) => {
}
});
// @todo DRY this shit up
// Read in fun facts
const funFactsFilePath = path.join(__dirname, 'conf', 'funfacts');
let funFacts = parseLines(funFactsFilePath);
fs.watchFile(funFactsFilePath, (curr, prev) => {
if (curr.mtime !== prev.mtime) {
funFacts = parseLines(funFactsFilePath);
}
});
// Read in ham facts
const hamFactsFilePath = path.join(__dirname, 'conf', 'hamfacts');
let hamFacts = parseLines(hamFactsFilePath);
fs.watchFile(hamFactsFilePath, (curr, prev) => {
if (curr.mtime !== prev.mtime) {
hamFacts = parseLines(hamFactsFilePath);
}
});
// Set up the native commands to handle
const commands = {
'sfx': (msg) => {
@@ -59,6 +79,50 @@ const commands = {
.on('start', () => {});
})(sfxPath);
},
'funfact': (msg) => {
if (funFacts.length > 0) {
// return random element from funFacts, unless one is specifically requested
let el;
let req = parseInt(msg.content.split(' ')[1]);
if (Number.isNaN(req) || typeof funFacts[req-1] === 'undefined') {
el = Math.floor(Math.random() * funFacts.length);
} else {
el = req - 1;
}
let displayNum = (el+1).toString();
let funFact = funFacts[el]
msg.channel.send({embed: {
"title": "FunFact #"+displayNum,
"color": 0xf30bff,
"description": funFact
}}).catch(console.error);
} else {
msg.channel.send("No fun facts found!");
}
},
'hamfact': (msg) => {
if (hamFacts.length > 0) {
// return random element from hamFacts, unless one is specifically requested
let el;
let req = parseInt(msg.content.split(' ')[1]);
if (Number.isNaN(req) || typeof hamFacts[req-1] === 'undefined') {
el = Math.floor(Math.random() * hamFacts.length);
} else {
el = req - 1;
}
let displayNum = (el+1).toString();
let hamFact = hamFacts[el]
msg.channel.send({embed: {
"title": "hamFact #"+displayNum,
"color": 0xf30bff,
"description": hamFact
}}).catch(console.error);
} else {
msg.channel.send("No ham facts found!");
}
},
'reboot': (msg) => {
if (msg.author.id == config.adminID) process.exit(); //Requires a node module like Forever to work.
}
@@ -101,3 +165,18 @@ function joinVoiceChannel(msg)
voiceChannel.join().then(connection => resolve(connection)).catch(err => reject(err));
});
}
// Read/parse text quotes from the "database"
function parseQuotes(filePath)
{
let commands = [];
let data = fs.readFileSync(filePath, 'utf-8');
let commandLines = data.toString().split('\n');
let commandParts;
commandLines.forEach(function(line) {
if (line.length > 0) {
commands.push(line);
}
});
return commands;
}

BIN
sfx/1v2.mp3 Normal file → Executable file

Binary file not shown.

BIN
sfx/airplane.mp3 Executable file

Binary file not shown.

BIN
sfx/archery.mp3 Executable file

Binary file not shown.

BIN
sfx/aww.mp3 Executable file

Binary file not shown.

BIN
sfx/bye.mp3 Executable file

Binary file not shown.

BIN
sfx/cd-plane.mp3 Executable file

Binary file not shown.

BIN
sfx/flippers.mp3 Executable file

Binary file not shown.

BIN
sfx/fu.mp3 Executable file

Binary file not shown.

BIN
sfx/gyst.mp3 Executable file

Binary file not shown.

BIN
sfx/joshlaugh2.mp3 Executable file

Binary file not shown.

BIN
sfx/laugh.mp3 Executable file

Binary file not shown.

BIN
sfx/laugh2.mp3 Executable file

Binary file not shown.

BIN
sfx/learnding.mp3 Executable file

Binary file not shown.

BIN
sfx/mothhole.mp3 Executable file

Binary file not shown.

BIN
sfx/muttlaugh.mp3 Executable file

Binary file not shown.

BIN
sfx/myman.mp3 Executable file

Binary file not shown.

BIN
sfx/nfc.mp3 Executable file

Binary file not shown.

BIN
sfx/rando.mp3 Executable file

Binary file not shown.

BIN
sfx/rawr.mp3 Executable file

Binary file not shown.

BIN
sfx/swag.mp3 Normal file → Executable file

Binary file not shown.

BIN
sfx/waow.mp3 Executable file

Binary file not shown.

BIN
sfx/wow.mp3 Normal file → Executable file

Binary file not shown.