A Node.js project for managing a Discord bot with features like anecdote publishing, announcements, notable date messages, and more. Built using discord.js.
This bot was created for the Boaki Actu community, bringing together several hundred players around an old video game.
- Publish predefined anecdotes or choose one at random.
- Send announcements to specified channels with optional interactive buttons.
- Automatically post notable events for the current day.
- Role-based notifications and interactive button management.
- Scheduled tasks for anecdotes and notable dates.
- Automatically refresh the bot’s status based on configured activities.
- Update existing bot messages.
- Fetch and publish the latest verified speedruns with interactive components.
Clone the repository and install dependencies:
git clone https://github.com/BChevillon/boaki-actu-discord-bot.git
cd boaki-actu-discord-bot
npm install- Setup the
config.jsonfile in the project directory:{ "token": "YOUR_DISCORD_BOT_TOKEN", "clientId": "YOUR_DISCORD_CLIENT_ID", "guildId": "YOUR_DISCORD_GUILD_ID", "adminRolesId": ["ROLE_ID_FOR_ADMIN_1", "ROLE_ID_FOR_ADMIN_2"], "anecdoteRoleId": "ROLE_ID_FOR_ANECDOTES", "speedrunChannelId": "CHANNEL_ID_FOR_SPEEDRUNS", "activities": [ { "name": "ACTIVITY_NAME_1", "type": "ACTIVITY_TYPE_1" }, { "name": "ACTIVITY_NAME_2", "type": "ACTIVITY_TYPE_2" } ], "speedrunGames": [ { "name": "GAME_NAME", "id": "SRC_GAME_ID", "thumbnails": { "level_id": "https://example.com/thumbnail.png", "default": "https://example.com/default_thumbnail.png" } } ] } - Add JSON data files for anecdotes and notable dates:
data/anecdotes.jsondata/notabledate.json
Start the bot using:
node index.js- Description: Publishes an anecdote.
- Parameters:
canal: The target channel.id(optional): The ID of a specific anecdote.
- Example:
/anecdote canal:#general id:3
- Description: Sends an announcement to a target channel.
- Parameters:
canal_message: Source channel of the announcement.message_id: ID of the message to announce.canal_envoi: Target channel.everyone(optional): Mention@everyone.notifications(optional): Add a notifications button.
- Example:
/annonce canal_message:#announcements message_id:123456789 canal_envoi:#general everyone:true
- Description: Modify an existing message sent by the bot by replacing its content with that of another.
- Parameters:
canal_source: Source channel of the message whose content will be copied.source_message_id: ID of the message to copy.canal_modification: Channel of the message to modify.message_id: ID of the message to modify.
- Example:
/modifiermessage canal_source:#general source_message_id:123456789 canal_modification:#announcements message_id:987654321
- Description: Publishes a notable event for today.
- Parameters:
canal: The target channel.
- Example:
/datenotable canal:#general
- Description: Checks if the bot is online.
- Example:
/ping
Schedules a weekly anecdote publication.
- Configurable via
startAnecdoteScheduler(client, channelId, roleId).
Schedules a daily notable event message.
- Configurable via
startDateScheduler(client, channelId, roleId).
Schedules automatic publication of verified speedruns.
- Configurable via
startSpeedrunScheduler(client, channelId, game).
Interactive buttons for:
- Notifications: Toggle role for users.
- Links: Add external references.
Use handleInteraction(interaction, roleId) to manage button interactions.
Activities for the bot are defined in the config.json file under the activities section. Each activity contains:
name: The activity name displayed in the bot’s status.type: The type of activity (Playing,Listening,Watching, orStreaming).
For example:
"activities": [
{ "name": "Exploring Boaki", "type": "Playing" },
{ "name": "Sharing Boaki history", "type": "Streaming" },
{ "name": "Guiding new players", "type": "Listening" },
{ "name": "www.univers-kipulkai.fr", "type": "Watching" }
]The bot automatically fetches and publishes the latest verified speedruns for configured games from config.json.
- Displays player, category, level, ranking, and time.
- Interactive buttons allow users to view the run and learn more about speedrunning on the Univers-KiPulKai website.
- The games to monitor for speedruns are configured in the
speedrunGamessection ofconfig.jsonwith their IDs and associated level thumbnails.
Example configuration for a speedrun game in config.json:
"speedrunGames": [
{
"name": "KiPulKai : la légende des 3 masques",
"id": "369wxy8d",
"thumbnails": {
"dqzj12gd": "https://www.univers-kipulkai.fr/wp-content/uploads/2025/02/speedrun_icon_0.png",
"d7yv3ked": "https://www.univers-kipulkai.fr/wp-content/uploads/2025/02/speedrun_icon_1.png",
"default": "https://www.univers-kipulkai.fr/wp-content/uploads/2025/02/speedrun_icon_default.png"
}
}
]This module was created by Benoit CHEVILLON. If you have any questions, feedback, or bug reports, you can open an issue on GitHub or contact via email at benoit.chevillon6@gmail.com.
This project is licensed under the MIT License.