Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romozz/reddit-discord-image
Random subreddit image in discord
https://github.com/romozz/reddit-discord-image
discord discord-js node nodejs npm-package reddit reddit-api
Last synced: about 1 month ago
JSON representation
Random subreddit image in discord
- Host: GitHub
- URL: https://github.com/romozz/reddit-discord-image
- Owner: Romozz
- Created: 2022-09-03T23:53:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-11T09:44:40.000Z (about 2 years ago)
- Last Synced: 2024-11-17T04:44:35.942Z (about 1 month ago)
- Topics: discord, discord-js, node, nodejs, npm-package, reddit, reddit-api
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/reddit-discord-image
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
**Node.js 16.6.0 or newer is required**```bash
$ npm install reddit-discord-image
```## MessageCreate v13
```js
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