Skip to content

Commit

Permalink
get standings function
Browse files Browse the repository at this point in the history
  • Loading branch information
SwapnikKatkoori committed Jun 23, 2019
1 parent 77bed40 commit 815ce83
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
43 changes: 42 additions & 1 deletion sleeper_ff_bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
import schedule
import os
from group_me import GroupMe
from slack import Slack
from discord import Discord
from sleeper_wrapper import League


def get_matchups(league_id, week):
league = League(league_id)
matchups = league.get_matchups(week)
users = league.get_users()
rosters = league.get_rosters()
scoreboards = league.get_scoreboards(rosters, matchups, users)

final_message_string = ""

for matchup_id in scoreboards:
matchup = scoreboards[matchup_id]
matchup_string = "{} VS. {} \n".format(matchup[0][0], matchup[1][0])
final_message_string += matchup_string

return final_message_string

def get_standings(league_id, week):
league = League(league_id)
rosters = league.get_rosters()
users = league.get_users()
standings = league.get_standings(rosters,users)



def main():
pass
bot = None
bot_type = os.environ["BOT_TYPE"]
bot_id = os.environ["BOT_ID"]

if bot_type == "groupme":
bot = GroupMe(bot_id)
elif bot_type == "slack":
bot = Slack(bot_id)
else:
bot = Discord(bot_id)

bot.send_message(get_matchups(355526480094113792, 11))


main()
2 changes: 1 addition & 1 deletion sleeper_ff_bot/group_me.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ def __init__(self, bot_id):
self.bot_id = bot_id

def send_message(self, message):
requests.post("https://api.groupme.com/v3/bots/post", data={"text":message, "bot_id":bot_id} )
requests.post("https://api.groupme.com/v3/bots/post", data={"text":message, "bot_id":self.bot_id} )
Empty file added tests/test_bot.py
Empty file.

0 comments on commit 815ce83

Please sign in to comment.