mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Allow video memes in meme
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = class MemeCommand extends SubredditCommand {
|
|||||||
description: 'Responds with a random meme.',
|
description: 'Responds with a random meme.',
|
||||||
details: `**Subreddits:** ${subreddits.join(', ')}`,
|
details: `**Subreddits:** ${subreddits.join(', ')}`,
|
||||||
clientPermissions: ['ATTACH_FILES'],
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
postType: 'image',
|
postType: ['image', 'rich:video'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'subreddit',
|
key: 'subreddit',
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "92.2.3",
|
"version": "92.2.4",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module.exports = class SubredditCommand extends Command {
|
|||||||
super(client, info);
|
super(client, info);
|
||||||
|
|
||||||
this.subreddit = info.subreddit;
|
this.subreddit = info.subreddit;
|
||||||
this.postType = info.postType;
|
this.postType = Array.isArray(info.postType) ? info.postType : [info.postType];
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { subreddit }) {
|
async run(msg, { subreddit }) {
|
||||||
@@ -38,7 +38,7 @@ module.exports = class SubredditCommand extends Command {
|
|||||||
const posts = body.data.children.filter(post => {
|
const posts = body.data.children.filter(post => {
|
||||||
if (!post.data) return false;
|
if (!post.data) return false;
|
||||||
if (!nsfw && post.data.over_18) return false;
|
if (!nsfw && post.data.over_18) return false;
|
||||||
return (this.postType ? post.data.post_hint === this.postType : true) && post.data.url && post.data.title;
|
return (this.postType ? this.postType.includes(post.data.post_hint) : true) && post.data.url && post.data.title;
|
||||||
});
|
});
|
||||||
if (!posts.length) return null;
|
if (!posts.length) return null;
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user