added lewdness

This commit is contained in:
cameron 2018-06-13 03:29:51 -04:00
parent 66535142b2
commit 2d23bd898a
3 changed files with 63 additions and 4 deletions

View File

@ -30,7 +30,7 @@ class GameServer {
}).catch((error) => { }).catch((error) => {
msg.reply("Server is offline!"); msg.reply("Server is offline!");
}); });
} else if(msg.content.startsWith('!gm') { } else if(msg.content.startsWith('!gm')) {
try { try {
let gameinfo = await Gamedig.query({type: 'garrysmod', let gameinfo = await Gamedig.query({type: 'garrysmod',
host: 'construct420.game.nfoservers.com'}); host: 'construct420.game.nfoservers.com'});

View File

@ -0,0 +1,62 @@
const Discord = require("discord.js");
const fs = require('fs');
const request = require('request');
const rp = require('request-promise-native');
class Lewd {
constructor() {
this.matches = [ "tits", "ass", "booty", "thicc", "2d" ];
}
async loadSubreddit(name) {
let subredditData = await rp(`https://www.reddit.com/r/${name}.json`);
try {
let sJson = JSON.parse(subredditData);
return sJson;
} catch (e) {
console.log("Invalid JSON!");
return "";
}
}
async getRandomEntry(subreddit) {
let srData = await this.loadSubreddit(subreddit);
let count = srData.data.children.length;
for(let i = 0; i < 10; i++) {
let selection = Math.floor(Math.random() * count);
let url = srData.data.children[selection].data.url;
if(url.endsWith('.jpg') || url.endsWith('.gif') || url.endsWith('.png') || url.endsWith('.jpeg') || url.endsWith('.gifv')) {
return url;
}
}
return -1;
}
async getRandomRedditImg(sub) {
let rEmbed = new Discord.RichEmbed();
let img = await this.getRandomEntry(sub);
console.log(img);
rEmbed.setImage(img);
return rEmbed;
}
async action(msg) {
let chan = msg.channel;
if(msg.content.startsWith('!tits')) {
chan.send(await this.getRandomRedditImg('homegrowntits+BigBoobsGW+Boobies'));
} else if (msg.content.startsWith('!booty') || msg.content.startsWith('!ass')) {
chan.send(await this.getRandomRedditImg('bigasses+whooties+pawg'));
} else if (msg.content.startsWith('!thicc')) {
chan.send(await this.getRandomRedditImg('thick+thicker+voluptuous'));
} else if (msg.content.startsWith('!2d')) {
chan.send(await this.getRandomRedditImg('hentai+rule34'));
}
}
}
module.exports = Lewd;

View File

@ -34,15 +34,12 @@ async function main() {
} }
console.log(triggers);
client.login('MzYyNzU1MzE3MTczNTgzODcy.DK3R1A.8M22ZkNaaoHy-ifBQwVivSU7svY'); client.login('MzYyNzU1MzE3MTczNTgzODcy.DK3R1A.8M22ZkNaaoHy-ifBQwVivSU7svY');
client.on('ready', () => { client.on('ready', () => {
console.log(`Logged into Discord as ${client.user.tag}`); console.log(`Logged into Discord as ${client.user.tag}`);
}); });
client.on('message', async (msg) => { client.on('message', async (msg) => {
for(const t in triggers) { for(const t in triggers) {
console.log(t);
if (msg.content.startsWith(`!${t}`)) { if (msg.content.startsWith(`!${t}`)) {
console.log(`+ Bot module ${triggers[t]} triggered.`); console.log(`+ Bot module ${triggers[t]} triggered.`);
await bot_modules[triggers[t]].action(msg); await bot_modules[triggers[t]].action(msg);