Added override function

This commit is contained in:
cameron 2023-03-07 21:51:18 -05:00
parent 921b0690cc
commit 133393bf38
2 changed files with 19 additions and 1 deletions

View File

@ -136,6 +136,18 @@ class Lewd {
const shasum = crypto.createHash('sha256');
let rEmbed = new Discord.MessageEmbed();
let imgInfo = await this.getRandomEntry(sub);
console.log(fs.existsSync('./bot-modules/lewd/override.txt'));
if(fs.existsSync('./bot-modules/lewd/override.txt')) {
console.log('Override.txt detected. Overriding response');
const overrides = fs.readFileSync('./bot-modules/lewd/override.txt').toString();
const overrideList = overrides.split('\n');
if(overrideList.length > 0) {
imgInfo = { 'url' : overrideList[0], 'subreddit' : 'None', 'author': 'None', 'title': 'Custom', 'upvote_ratio':'0.5' };
overrideList.shift();
const newList = overrideList.join('\n');
fs.writeFileSync('./bot-modules/lewd/override.txt', newList);
}
}
shasum.update(imgInfo.url);
const shaHash = shasum.digest('hex').slice(0,9);
@ -189,7 +201,7 @@ class Lewd {
async action(msg) {
let chan = msg.channel;
if(msg.content.startsWith('!tits')) {
await sendAndLog(chan,'homegrowntits+BigBoobsGW+Boobies+hugehangers+biggerthanyouthought+udders+tittydrop');
await this.sendAndLog(chan,'homegrowntits+BigBoobsGW+Boobies+hugehangers+biggerthanyouthought+udders+tittydrop');
} else if (msg.content.startsWith('!booty') || msg.content.startsWith('!ass')) {
await this.sendAndLog(chan,'bigasses+pawg+slightcellulite');
} else if (msg.content.startsWith('!thicc')) {

6
run-bot.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
until node main.js; do
echo "Server crashed. Respawning..."
sleep 1
done