Skip to content

Commit

Permalink
feat: meme command
Browse files Browse the repository at this point in the history
Co-Authored-By: sadie brooklyn <senkodev@gmail.com>
  • Loading branch information
SuperchupuDev and Nyameliaaaa committed Sep 27, 2021
1 parent 2c3b268 commit 2b3b15d
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions commands/fun/meme.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
const snoo = require('snoowrap');

const r = new snoo({
userAgent: 'G.A.S-Bot<Next>',
clientId: '49z0Xcek_8DeB8LyDjsjyA',
clientSecret: process.env.REDDIT_TOKEN,
refreshToken: process.env.REDDIT_REFRESH
const Snoowrap = require('snoowrap');
const reddit = new Snoowrap({
userAgent: 'gasbot',
clientId: process.env.REDDIT_CLIENT_ID,
clientSecret: process.env.REDDIT_TOKEN,
refreshToken: process.env.REDDIT_REFRESH
});

module.exports = {
name: 'meme',
description: 'Shows you a meme!',
name: 'meme',
description: 'Displays a meme from Reddit',

async execute(client, message) {
const memeReddits = ['memes', 'dankmemes', 'comedynecrophilia', 'theletterh', 'okbuddyretard', '196', 'comedyheaven'];
const sourceReddit = memeReddits[Math.floor(Math.random() * memeReddits.length)];
async execute(client, message) {
const subreddits = ['memes', 'dankmemes', 'comedynecrophilia', 'theletterh', 'okbuddyretard', '196', 'comedyheaven'];
const randomSubreddit = subreddits[Math.floor(Math.random() * subreddits.length)];

const post = r.getHot(sourceReddit);
console.log(post);
const listing = (await reddit.getHot(randomSubreddit)).filter(p => !p.over_18 && p.is_reddit_media_domain && !p.is_video);
const post = listing[Math.floor(Math.random() * listing.length)];

message.channel.send({
embeds: [{
title: 'this is supposed to be real',
description: sourceReddit,
color: client.config.color
}]
});
}
message.channel.send({
embeds: [{
title: post.title.replaceAll(/g/giu, 'q'),
url: `https://reddit.com${post.permalink}`,
image: post.preview.images[0].variants.gif?.source ?? post.preview.images[0].source,
author: {
name: post.subreddit_name_prefixed
},
footer: {
text: `u/${post.author.name}`
},
timestamp: post.created * 1000,
color: client.config.color
}]
});
}
};

0 comments on commit 2b3b15d

Please sign in to comment.