This is a Discord self-bot that fetches random memes from specified channels and serves them through an Express.js web server and uses discord.js-selfbot-v13 in backend.
- Clone this repository through
git clone https://github.com/Awesome-Tofu/MemeFetcher-Discord
andcd MemeFetcher-Discord
. - Install the necessary dependencies with
npm install
. - Edit the
config.js
file in the root directory with the following structure:
module.exports = {
TOKEN: process.env.TOKEN || "your-discord-token",
CHANNEL_IDs: ["channel_id1", "channel_id2", "you can add more this way..."]
};
If you dont want to add your TOKEN here, you can add in .env
file. I would prefer you to add it in environment.
Replace 'your-discord-token'
with your Discord token and 'channel-id-1', 'channel-id-2', 'channel-id-3'
with the IDs of the channels you want to fetch memes from.
To get Dicord token, go here
To get the ID of a channel in Discord, you can follow these steps:
- Enable Developer Mode: Go to your Discord settings, then navigate to the "Advanced" tab. Under the "Advanced" section, toggle on "Developer Mode".
- Right-click the Channel: Once Developer Mode is enabled, go back to your Discord server. Right-click on the meme channel whose ID you want to obtain.
- Select "Copy ID": After right-clicking on the channel, you should see an option to "Copy ID". Click on it, and the ID of the channel will be copied to your clipboard.
- Paste the ID: You can now paste the channel ID wherever you need it, such as in your code or in any other Discord-related context.
Start the bot with node index.js
or npm start
. The bot will log into Discord and start the web server.
You can then access the /meme
route on localhost:3000
to fetch a random message with a media attachment from the specified channels. You can also specify the type of media you want (image or video) and the channel from which to fetch messages using query parameters:
type
: Set this to'image'
to fetch an image attachment, or'video'
to fetch a video attachment. If not specified or if set to any other value, a random attachment will be fetched.channel
: Set this to the ID of a channel to fetch messages from that channel. If not specified, messages will be fetched from a random channel. Make sure bot is in the server of the channel ID.
For example, to fetch an image from a specific channel, you would use a URL like this: localhost:3000/meme?type=image&channel=channel-id
If no media attachments are found, the server will respond with a 404 error.
It's important to note that you should use channel IDs responsibly and in accordance with Discord's terms of service. Misusing channel IDs or any other Discord-related information can lead to your account being banned.