Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enleve reminder, ajout option message anglais francais #109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions create_usernames_spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,19 @@
header_range = config['header_range']
gsheets.update_values(sheet_id, header_range, header)


# Create the data to be inserted, sort by name alphabetically

if locale == "fr":
start_username=0;
else:
start_username=100;

data = [
[eval('f' + repr(config['username_template'])), attendee['name']]
for user_index, attendee in enumerate(sorted(attendees.values(), key=lambda x: x['name'].casefold()))
for user_index, attendee in enumerate(sorted(attendees.values(), key=lambda x: x['name'].casefold()), start=start_username)
]

data_range = config['data_range']
gsheets.update_values(sheet_id, data_range, data)

Expand All @@ -141,15 +149,23 @@
if not slack.is_member(channel_name):
slack.join_channel(channel_name)

message = f"Username spreadsheet: {sheet_url}"

if filename_template == config.get('filename_template_en'):
message = f"To connect to the platform, select your username (beside your name) here: {sheet_url}"
else:
message = f"Pour vous connecter à la plateforme, sélectionner votre nom d'utilisateur (associé à votre nom) ici: {sheet_url}"

start = to_iso8061(event['start']['local'])

# post now
slack.post_to_channel(channel_name, message)

# post a reminder 30 minutes before start
post_time = start + datetime.timedelta(minutes=-30)
slack.post_to_channel(channel_name, message, post_time)
# post_time = start + datetime.timedelta(minutes=-30)
# slack.post_to_channel(channel_name, message, post_time)

# add a bookmark
slack.add_bookmark_to_channel(channel_name, "Username spreadhseet", sheet_url)
if args.update:
slack.update_channel_bookmarks(channel_name, slack.list_channel_bookmarks(channel_name))
else:
slack.add_bookmark_to_channel(channel_name, "Username spreadhseet", sheet_url)