A self-hosted Discord bot for locking and unlocking a channel based on a schedule. This bot can join multiple Discord servers, however, it will work on the same schedule on all of them. Currently, the schedule must be specified in UTC.
Binaries for x64 Linux and Windows are available on the releases page
cargo run --release
in the cloned repositorybot.cfg
should appear in your working directory after running cargo run --release
)cargo run --release
againFor cross-compilation I recommend cross
cross build --target arm-unknown-linux-musleabihf --release
, replace arm-unknown-linux-musleabihf
with the target (arm-unknown-linux-musleabihf
is ok for Raspberry Pi 3)bot.cfg
file, replace DISCORD_TOKEN
with the token you got from the tutorialThe bot searches for bot.cfg
in its working directory. An example configuration file will be created when the bot is run for the first time.
discord_token = 'DISCORD_TOKEN' # discord api token
channel_name = 'example-channel' # name of the channel to lock (channel will be created if it doesn't exist)
role_name = 'example-role' # name of the role that should be locked out of the channel
lock_message = 'locked' # message to post when locking the channel (the message will be posted in the channel that's being locked)
unlock_message = 'unlocked' # message to post when unlocking the channel
lock_on = '0 0 0 * * Mon *' # locking schedule in crontab format, ***in UTC***
unlock_on = '0 0 21 * * Sun *' # unlocking schedule in crontab format, ***in UTC***
agressive_lock = true # if enabled, when the channel is locked, the bot will delete all messages posted to that channel
upcoming
method of Schedule
from job_scheduleragressive_lock
should work only if a user has the role specified in the configurationThis project is licensed under the MIT License - see the LICENSE.md file for details