reddit-discord-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Npm package versionNpm package total downloads

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

Package Sidebar

Install

npm i reddit-discord-image

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

6.3 kB

Total Files

6

Last publish

Collaborators

  • romoz