mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Allow users to pick a specific meme subreddit
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
"memes",
|
||||
"dankmemes",
|
||||
"surrealmemes",
|
||||
"MemeEconomy",
|
||||
"memeeconomy",
|
||||
"wholesomememes",
|
||||
"tumblr",
|
||||
"me_irl",
|
||||
"meirl",
|
||||
"blessedimages",
|
||||
"HistoryMemes",
|
||||
"WhitePeopleTwitter",
|
||||
"historymemes",
|
||||
"whitepeopletwitter",
|
||||
"coaxedintoasnafu",
|
||||
"Animemes",
|
||||
"animemes",
|
||||
"programmerhumor"
|
||||
]
|
||||
|
||||
+14
-3
@@ -1,6 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { list } = require('../../util/Util');
|
||||
const subreddits = require('../../assets/json/meme');
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
@@ -10,12 +11,22 @@ module.exports = class MemeCommand extends Command {
|
||||
group: 'random',
|
||||
memberName: 'meme',
|
||||
description: 'Responds with a random meme.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
details: `**Subreddits**: ${subreddits.join(', ')}`,
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'subreddit',
|
||||
prompt: `What subreddit do you want to get memes from? Either ${list(subreddits, 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: subreddits,
|
||||
default: () => subreddits[Math.floor(Math.random() * subreddits.length)],
|
||||
parse: subreddit => subreddit.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const subreddit = subreddits[Math.floor(Math.random() * subreddits.length)];
|
||||
async run(msg, { subreddit }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://www.reddit.com/r/${subreddit}/top.json`)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "90.3.4",
|
||||
"version": "90.3.5",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user