This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 725814f
Showing
5 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## How to contribute to College Football Risk | ||
|
||
#### **Did you find a bug?** | ||
|
||
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/cfbd/college-risk/issues). | ||
|
||
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/cfbd/college-risk/issues/new?assignees=bluescar). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. | ||
|
||
#### **Did you write a patch that fixes a bug?** | ||
|
||
* Open a new GitHub pull request with the patch. | ||
|
||
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. | ||
|
||
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?** | ||
|
||
Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of College Football Risk will generally not be accepted. | ||
|
||
#### **Do you intend to add a new feature or change an existing one?** | ||
|
||
* Suggest your change by reaching out to me via [email](mailto:[email protected]) or [Twitter](https://twitter.com/CFB_Risk) and start writing code. | ||
|
||
* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes. | ||
|
||
#### **Do you have questions about the source code?** | ||
|
||
* Please do reach out to me via [email](mailto:[email protected]) or [Twitter](https://twitter.com/CFB_Risk) with any questions you may have. | ||
|
||
Thanks! | ||
|
||
BlueSCar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!--- Provide a general summary of your changes in the Title above --> | ||
|
||
## Description | ||
<!--- Describe your changes in detail --> | ||
|
||
## Motivation and Context | ||
<!--- Why is this change required? What problem does it solve? --> | ||
<!--- If it fixes an open issue, please link to the issue here. --> | ||
|
||
## How Has This Been Tested? | ||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, tests ran to see how --> | ||
<!--- your change affects other areas of the code, etc. --> | ||
|
||
## Screenshots (if appropriate): | ||
|
||
## Types of changes | ||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> | ||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
|
||
## Checklist: | ||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | ||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | ||
- [ ] My code follows the code style of this project. | ||
- [ ] My change requires a change to the documentation. | ||
- [ ] I have updated the documentation accordingly. | ||
|
||
|
||
<!--- Don't remove or modify anything beneath this line. --> | ||
@BlueSCar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 CFBD | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Risk Python Scripts | ||
This repo is intended to to be a library of generic Python scripts for College Football Risk. The primary purpose is to give leadership of teams appropriate resources to organize and recruit, particularly if the team has lacked much organization in the past. | ||
|
||
## General Reddit Notification (general_reddit_notification.py) | ||
|
||
This script can be used to send out a general notification via reddit PMs. The script requires a CSV files which it uses to read the list of players to message. The CSV file should contain at least one column of valid reddit usernames with a "player" header. | ||
|
||
This script is fault tolerant and will continue to process the batch of players, even if one of the messages fails. The script will output two text files denoting which players were successfully messages and which failed. | ||
|
||
Required fill ins: | ||
|
||
* CLIENT_ID - Reddit client id obtained from the Reddit development console | ||
* CLIENT_SECRET - Reddit client secret obtained from the Reddit development console | ||
* APP_NAME - used in the user-agent string and must be unique | ||
* APP_VERSION - used in the user-agent string | ||
* USERNAME - Username of account used for sending PMs | ||
* PASSWORD - Password of account used for sending PMs | ||
* TEAM - Name of team | ||
* PLACE_MESSAGE_HERE - Contents of message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pandas as pd | ||
import praw | ||
|
||
reddit = praw.Reddit(client_id='CLIENT_ID', | ||
client_secret='CLIENT_SECRET', | ||
user_agent='User-Agent: web:APP_NAME:vAPP_VERSION (by /u/USERNAME)', | ||
username='USERNAME', | ||
password='PASSWORD') | ||
|
||
# requires a populated CSV file with a 'player' column | ||
df = pd.read_csv('./players.csv') | ||
players = list(df['player']) | ||
|
||
successfully_messaged = [] #initializes empty list for users successfully messaged | ||
failed_to_message = [] #empty list for users not messaged | ||
|
||
|
||
for player in players: | ||
try: | ||
reddit.redditor(player).message('Join TEAM Risk today!', ''' | ||
Greeetings {0}! | ||
| ||
PLACE_MESSAGE_HERE | ||
| ||
You will receive no further messages from us. Hope you join us! | ||
TEAM Risk Leadership | ||
'''.format(player)) | ||
print(player + ' messaged successfully!') | ||
successfully_messaged = successfully_messaged + [player] | ||
except: | ||
print("Error in messaging user " + player) | ||
failed_to_message = failed_to_message + [player] | ||
|
||
# output successes and failures to separate text files | ||
with open('successes.txt', 'w') as f: | ||
for item in successfully_messaged: | ||
f.write("%s\n" % item) | ||
|
||
with open('failures.txt', 'w') as f: | ||
for item in failed_to_message: | ||
f.write("%s\n" % item) |