A simple Discord bot to fetch schedule-related tweets and spaces to feed our Hololive and Nijisanji calendars.
-
Obtain a Discord bot token.
-
Clone the repo and install the requirements:
pip install --no-cache-dir -r requirements.txt
-
Set the BOT_TOKEN and API_URL environment variables with the token from step 1 and the blooop URL respectively.
-
Customize the configuration for scraping and notifying: edit the
data.py
file and fill in all the values. -
Finally, run
python main.py
. If everything went well, you should see an output similar to this:2023-02-18 00:26:56 [NAME] Loaded <n> extra pings 2023-02-18 00:26:56 [NAME] Logged in as <your bot name and ID>
The bot automatically sends new tweets in the specified channel every 60 seconds
(the timeout is configurable in main.py
), pinging the specified role if any keyword matches.
The watched talents and keywords can be set in the data.py
file.
Optionally you can also use /fetch
to fetch and display new tweets and spaces manually.
If you don't see the slash command in your server, wait around one hour to allow it
to sync, or check that you invited the bot with the applications.commands
scope.
The already scraped tweets and spaces are saved each time so you won't see the same one twice;
by default the IDs are written in the config/[NAME]_tweets.ini
and config/[NAME]_spaces.ini
files (configurable in main.py
as well).
Create a .env
file with the environment variables mentioned in step 3,
then build or pull the image from Dockerhub and run it:
docker build . -t scheduletweetbot
docker run --name scheduletweetbot --env-file .env scheduletweetbot
Logo by the one and only DuDuL!
Twitter data is provided by blooop.
Huge thanks to the teams of KFP | The Office
and Nijisanji EN Schedule Team
for helping with debugging and feature suggestions.