def __init__(self, bot): self.bot = bot self.gspread_client = google_utils.create_gspread_client() self.main_data_sheet = self.gspread_client.open_by_key( constants.MAIN_SHEET_KEY) self.reminder_tab = self.main_data_sheet.worksheet("Reminders")
def __init__(self, bot): # Bot and cipher_race initializations self.bot = bot # The current race will have channel_id as key, with # a dict containing level and current answers self.current_races = {} # Google Sheets Authentication and Initialization self.client = google_utils.create_gspread_client() self.spreadsheet = self.client.open_by_key( os.getenv('CIPHER_RACE_SHEET_KEY').replace('\'', '')) self.sheet_map = { cipher_race_constants.HP: google_utils.get_dataframe_from_gsheet( self.spreadsheet.worksheet( cipher_race_constants.HP_SHEET_TAB_NAME), cipher_race_constants.COLUMNS), cipher_race_constants.COMMON: google_utils.get_dataframe_from_gsheet( self.spreadsheet.worksheet( cipher_race_constants.COMMON_SHEET_TAB_NAME), cipher_race_constants.COLUMNS), cipher_race_constants.CHALLENGE: google_utils.get_dataframe_from_gsheet( self.spreadsheet.worksheet( cipher_race_constants.CHALLENGE_SHEET_TAB_NAME), cipher_race_constants.COLUMNS) }
def __init__(self, bot): self.bot = bot self.gspread_client = google_utils.create_gspread_client() self.sheet = self.gspread_client.open_by_key( os.getenv("DUELING_SHEET_KEY")) self.quotes_tab = self.sheet.worksheet("QuotesDatabase") self.quarter_tab = self.sheet.worksheet("QuarterQuestions")
def __init__(self, bot: commands.Bot): self.bot = bot self.gspread_client = google_utils.create_gspread_client() self.activity_calendar_sheet = self.gspread_client.open_by_key( constants.MAIN_SHEET_KEY).sheet1 self.reddit_client = reddit_utils.create_reddit_client()
def __init__(self, bot): self.bot = bot self.gspread_client = google_utils.create_gspread_client() self.main_data_sheet = self.gspread_client.open_by_key( constants.MAIN_SHEET_KEY) self.checklist_tab = self.main_data_sheet.worksheet( "Monthly Checklist")
def __init__(self): # We keep a dataFrame of all the new comments which should be considered for house points. self.df = pd.DataFrame(columns=constants.COLUMNS) cur_time = datetime.now() self.month = cur_time.month self.year = cur_time.year # Testing year change # self.year = '2000' # Create the gsheets client, open the worksheet. gsheets = google_utils.create_gspread_client() sheet_key = os.getenv('SHEET_KEY').replace('\'', '') # TODO: Stay consistent with current month/year self.sheet = gsheets.open_by_key(sheet_key) try: # Current tab is month year (e.g. January 2022) self.current_tab = self.sheet.worksheet( google_utils.get_current_tab_name()) except WorksheetNotFound: # If the tab doesn't exist, create it. # args are the name of the tab, the number of rows/columns, and position in spreadsheet # TODO: is it right to always make it the tab after the ping list tab? self.current_tab = self.sheet.add_worksheet( google_utils.get_current_tab_name(), 0, len(constants.COLUMNS), 1) self.submission_ids = pd.DataFrame( self.current_tab.get_all_records(), columns=constants.COLUMNS)[constants.ID] print(self.submission_ids) self.reddit = reddit_utils.create_reddit_client() # TODO: for testing #self.subreddit = self.reddit.subreddit(constants.SUBREDDIT_NAME) self.subreddit = self.reddit.subreddit('kevsTestSubreddit4') print( f"[ {google_utils.get_formatted_time()} ] Have connected to {self.subreddit.display_name}" )
def main(): reddit_client = reddit_utils.create_reddit_client() gspread_client = google_utils.create_gspread_client() spreadsheet = gspread_client.open_by_key( os.getenv('SHEET_KEY').replace('\'', '')) ping_mods(spreadsheet, reddit_client)