With this bot you're able to keep track of commits made to a Perforce version control server within a Discord channel.
- Within your Discord server go to the settings for the channel you'd like the commit logs to be posted to and copy the webhook URL.
- Save the webhook URL as an environment variable called
DISCORD_WEBHOOK_URL
. - The service requires access to the
p4 changes
command in the terminal, your bot should be installed somewhere where it can automatically perform this command without the session expiring. Once suitable access has been provided you'll need to run$ pip install -r requirements.txt
followed by$ python app.py
to initialize it. - Optionally you should consider creating a CRON script or something similar that restarts the
app.py
file on server reboot in order to keep the bot alive.
Unit tests can be run using the $ python tests.py
command.
Every thirty seconds the bot runs a Perforce command in the terminal that checks for the most recent changes. If it finds one it stores it in memory, if the change it finds is the same as the one it gathered previously then it discards it. You'll need to provide the bot with access to your servers Perforce command line. One way of doing this is running the Python application on the server which hosts your Perforce instance. If you can type p4 changes
yourself then the bot will be able to do its thing.
The installation will require you to enter a number of settings as environment variables. Below you'll find an explanation of each.
Key | Value Information | Required |
---|---|---|
DISCORD_WEBHOOK_URL |
The Webhook URL for the Discord channel you'd like the bot to post its messages to. | Yes |