This Python script fetches the latest entries from multiple RSS feeds and sends them to a Discord channel. The bot uses the discord and feedparser libraries to interact with Discord and parse RSS feeds, respectively.
- discord
- feedparser
- dotenv
- pyyaml
-
run
pip3 install -r requirements.txt
-
Rename the file
.env.dev
to.env
- Go to https://discord.com/developers/applications create an application
- Build a Discord bot under the application
- Click Reset Token and then copy the token
- Turn ALL INTENT
ON
- Invite your bot to your server via OAuth2 URL Generator
- Store the Discord Channel ID, Bot Token, RSS Feed URLs and Timezone to
.env
under theDISCORD_CHANNEL_ID
,DISCORD_BOT_TOKEN
, andRSS_FEED_URLS
You're all set.
-
Open a terminal or command prompt
-
Navigate to the directory where you cloned the repository
-
Run
python3 main.py
to start the bot
-
This bot works by periodically fetching the latest articles from one or more RSS feeds and sending them to specified Discord channels.
-
When the bot starts, it logs in to Discord using a bot token and sets up a loop that runs indefinitely. Inside the loop, the bot fetches the RSS feeds and checks for new articles. If a new article is found, the bot sends a message to the specified Discord channel with the article title and link.
-
The bot keeps track of which articles have already been sent to each channel using a YAML file called sent_articles.yaml. This file is updated every time a new article is sent, to ensure that duplicate articles are not sent to the same channel.