1.0.5 • Published 3 years ago

reddit-discord-image v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Installation

Node.js 16.6.0 or newer is required

$ npm install reddit-discord-image

MessageCreate v13

const { RedditImage } = require('../dist') // write reddit-discord-image instead ../dist
const { Client, Intents } = require('discord.js')
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] })
const reddit = new RedditImage()

client.on('messageCreate', async message => {
    if (message.content.startsWith('!reddit')) {
        const args = message.content.split(' ').splice(1)
        await reddit.fetch({
            reddit: args[0], // (required) subreddit name to find pictures
            limit: 1000, // (optional) the number of pictures among which you will get 1 random one
            sort: 'new', // (optional) a rather useless option, because the pictures are given out randomly
            time: 'week' // (optional) how old are the pictures you want to get
        })
        message.channel.send({ embeds: [reddit] })
    }
})

client.login(token)

Interaction v13

You can view interaction example at this link

More examples in examples

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-alpha

3 years ago