GithubHelp home page GithubHelp logo

vitalyvaryvdin / p4dbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesives/perforce-commit-discord-bot

0.0 0.0 0.0 593 KB

Posts the most recent commit messages from a Perforce version control server to a Discord channel.

License: MIT License

Python 100.00%

p4dbot's Introduction

Perforce Commit Logger Discord Bot

With this bot you're able to keep track of commits made to a Perforce version control server within a Discord channel.

Installation Steps

Setup Python

Install python2.7
Install python-pip
Install pip install enum34
Install pip install Discord-Webhooks

Setup P4

We have to install P4 on your computer.

Linux:

If the perforce server is using SSL, you'll have to trust the certificate. To know if it is using ssl, the perforce url should start with ssl:<URL>

p4 -p <PERFORCE URL> trust

Setup bot

  1. 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.
  2. In order to use this bot the config file needs to be set up config.json
  3. 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. $ python commit.py to initialize it.
  4. Optionally you should consider creating a CRON script or something similar that restarts the commit.py file on server reboot in order to keep the bot alive.

Getting Started

Every n 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 alternatively you can store the perforce credentials in the config.js .

If you can type p4 changes yourself then the bot will be able to do its thing.

Configuration

The installation will require you to enter a number of settings as environment variables. Below you'll find an explanation of each.

Required: JSON field needs to be there but it can be

Key Value Information Required Default
use_filter if set to true filters are being used yes false
pull_interval timer for the pull request to the perforce server yes 30.0

Configuration Group: p4

Key Value Information Required Default
host perforce server url yes
user perforce user null
password perforce password null
depot perforce depot url (include location of depot on disk + the depot name) (/root/depot/Y2018D-Y2-DigitalDeckbuilder) null
limit limit of commits yes 5
status perforce status (pending, submitted, or shelved) yes submitted
decode perforce commit message decoing yes ISO-8859-1
swarm swarm url yes

Configuration Group: filters

Filters are an optional array what can be used if the config field is set use_filter:true

Key Value Information
tag tag name the bot is filtering the commit messages
color hex code for the color

Example:

    "filters": [
        {
            "tag": "ADD",
            "color": "ff0000"
        }
    ]

Configuration Group: discord

Key Value Information
webhook_url webhook url for the noticiation
name discord user name (Not implemented)

Example

p4dbot's People

Contributors

dependabot-support avatar jamesives avatar simonrenger avatar vitalyvaryvdin avatar zandor300 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.