Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #10 from JamesIves/package
Browse files Browse the repository at this point in the history
Moving webhooks package
  • Loading branch information
JamesIves authored Nov 12, 2018
2 parents 5180ea9 + 54feecd commit 1a956bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 143 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ With this bot you're able to keep track of commits made to a [Perforce version c

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. Save the webhook URL as an environment variable called `DISCORD_WEBHOOK_URL`.
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. Once suitable access has been provided you can initialize the service by running `$ python app.py`.
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. Once suitable access has been provided you'll need to run `$ pip install -r requirements.txt` followed by `$ python app.py` to initialize the service.
4. Optionally you should create a CRON script or something similar that restarts the `app.py` file on server reboot in order to keep the bot alive through restarts.

## Getting Started :airplane:
Expand Down
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import subprocess
import time
from discord_hooks import Webhook
from discord_webhooks import DiscordWebhooks
from settings import DISCORD_WEBHOOK_URL

# Stores the most recent commit.
Expand Down Expand Up @@ -31,11 +31,11 @@ def post_changes():
payload = check_for_changes()

if payload != '':
message = Webhook(DISCORD_WEBHOOK_URL, color=0xc8702a)
message = DiscordWebhooks(DISCORD_WEBHOOK_URL)
message.set_content(color=0xc8702a, description='`%s`' % (payload))
message.set_author(name='Perforce')
message.set_desc('`%s`' % (payload))
message.set_footer(text='https://github.com/JamesIves/perforce-commit-discord-bot', ts=True)
message.post()
message.send()

else:
return
Expand Down
138 changes: 0 additions & 138 deletions discord_hooks.py

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests==2.20.0
Discord-Webhooks==1.0.3

0 comments on commit 1a956bc

Please sign in to comment.