Skip to content
Closed
Show file tree
Hide file tree
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
44 changes: 11 additions & 33 deletions prod-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,25 @@ registration_form_channel_name = "registration-form"
registration_help_channel_name = "registration-help"
registration_log_channel_name = "registration-log"

pretix_base_url = "https://pretix.eu/api/v1/organizers/europython/events/ep2025"
pretix_base_url = "https://pretix.eu/api/v1/organizers/pyladiescon/events/2025"

registered_cache_file = "registered_log.txt"
pretix_cache_file = "pretix_cache.json"

[registration.item_to_roles]
# onsite participants
"Business" = ["Participants", "Onsite Participants"]
"Personal" = ["Participants", "Onsite Participants"]
"Education" = ["Participants", "Onsite Participants"]
"Community Contributors" = ["Participants", "Onsite Participants"]
"Grant ticket" = ["Participants", "Onsite Participants"]
# remote participants
"Remote Participation Ticket" = ["Participants", "Remote Participants"]
"Remote Grant ticket" = ["Participants", "Remote Participants"]
"Remote Community Organiser" = ["Participants", "Remote Participants"]
# sponsors
"Sponsor Conference Pass" = ["Participants", "Onsite Participants", "Sponsors"]
"Remote Sponsor" = ["Participants", "Remote Participants", "Sponsors"]
# speakers
"Presenter" = ["Participants", "Onsite Participants", "Speakers"]
# onsite volunteers
"On-site Volunteer" = ["Participants", "Onsite Participants", "Volunteers", "Onsite Volunteers"]
# beginners' day
"Beginners’ Day Unconference / Humble Data Access" = ["Beginners Day"]
"Sponsors Ticket" = ["Participant", "Sponsor"]
"Speaker Ticket" = ["Participant", "Speaker"]
"General Ticket" = ["Participant"]

[registration.variation_to_roles]
# organizers
"Volunteer" = ["Organizers", "Volunteers", "Onsite Volunteers"]
"Volunteer" = ["Organizer", "Volunteer"]

[program_notifications]
# UTC offset in hours (e.g. 2 for CEST)
api_url = "https://static.europython.eu/programme/ep2025/releases/current/schedule.json"
# UTC offset in hours (e.g. 1 for CET)
api_url = "https://programapi.conference.pyladies.com/schedule.json"
schedule_cache_file = "schedule_cache.json"
livestream_url_file = "livestreams.toml"
main_notification_channel_name = "programme-notifications"
main_notification_channel_name = "session-notifications"

# optional simulated start time for testing program notifications
# simulated_start_time = "2024-07-10T07:30:00+02:00"
Expand All @@ -50,13 +33,8 @@ main_notification_channel_name = "programme-notifications"
# fast_mode = true

[program_notifications.rooms_to_channel_names]
"Forum Hall" = "forum-hall"
"South Hall 2A" = "south-hall-2a"
"South Hall 2B" = "south-hall-2b"
"North Hall" = "north-hall"
"Terrace 2A" = "terrace-2a"
"Terrace 2B" = "terrace-2b"
"Exhibit Hall" = "exhibit-hall"
"Main Stream" = "main-stream"
"Activities & Open Spaces" = "activities-open-spaces"

[guild_statistics]
required_role = "Organizers"
required_role = "Organizer"
2 changes: 1 addition & 1 deletion src/europython_discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def run_bot(config: Config, auth_token: str) -> None:


def main() -> None:
parser = argparse.ArgumentParser(description="EuroPython Discord Bot")
parser = argparse.ArgumentParser(description="PyLadiesCon Discord Bot")
parser.add_argument("--config-file", type=Path, required=True, help="Configuration file")
args = parser.parse_args()

Expand Down
32 changes: 17 additions & 15 deletions src/europython_discord/program_notifications/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from europython_discord.program_notifications import session_to_embed
from europython_discord.program_notifications.config import ProgramNotificationsConfig
from europython_discord.program_notifications.livestream_connector import LivestreamConnector
#from europython_discord.program_notifications.livestream_connector import LivestreamConnector
from europython_discord.program_notifications.program_connector import ProgramConnector

_logger = logging.getLogger(__name__)
Expand All @@ -25,7 +25,7 @@ def __init__(self, bot: Client, config: ProgramNotificationsConfig) -> None:
fast_mode=self.config.fast_mode,
)

self.livestream_connector = LivestreamConnector(self.config.livestream_url_file)
#self.livestream_connector = LivestreamConnector(self.config.livestream_url_file)

self.notified_sessions = set()
_logger.info("Cog 'Program Notifications' has been initialized")
Expand All @@ -48,7 +48,7 @@ async def cog_load(self) -> None:
"Starting the schedule updater and setting the interval for the session notifier..."
)
self.fetch_schedule.start()
self.fetch_livestreams.start()
#self.fetch_livestreams.start()
self.notify_sessions.change_interval(
seconds=2 if self.config.fast_mode and self.config.simulated_start_time else 60
)
Expand All @@ -66,11 +66,11 @@ async def fetch_schedule(self) -> None:
_logger.info("Starting the periodic schedule update...")
await self.program_connector.fetch_schedule()

@tasks.loop(minutes=5)
async def fetch_livestreams(self) -> None:
_logger.info("Starting the periodic livestream update...")
await self.livestream_connector.fetch_livestreams()
_logger.info("Finished the periodic livestream update.")
#@tasks.loop(minutes=5)
#async def fetch_livestreams(self) -> None:
# _logger.info("Starting the periodic livestream update...")
# await self.livestream_connector.fetch_livestreams()
# _logger.info("Finished the periodic livestream update.")

@tasks.loop()
async def notify_sessions(self) -> None:
Expand All @@ -96,16 +96,18 @@ async def notify_sessions(self) -> None:
room_channel = self._get_room_channel(room_name)

# update room's livestream URL
livestream_url = await self.livestream_connector.get_livestream_url(
room_name, session.start.date()
)
embed = session_to_embed.create_session_embed(session, livestream_url)
#livestream_url = await self.livestream_connector.get_livestream_url(
# room_name, session.start.date()
#)
#embed = session_to_embed.create_session_embed(session, livestream_url)
embed = session_to_embed.create_session_embed(session, None)


await main_notification_channel.send(embed=embed)
if room_channel is not None:
await room_channel.edit(
topic=f"Livestream: [YouTube]({livestream_url})" if livestream_url else ""
)
#await room_channel.edit(
# topic=f"Livestream: [YouTube]({livestream_url})" if livestream_url else ""
#)
await room_channel.send(
content=f"# Starting in 5 minutes @ {session.rooms[0]}",
embed=embed,
Expand Down
9 changes: 5 additions & 4 deletions src/europython_discord/program_notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@


class DaySchedule(BaseModel):
"""Schedule of a single day of EuroPython."""
"""Schedule of a single day of PyLadiesCon."""

rooms: list[str]
events: list[Session | Break]


class Schedule(BaseModel):
"""Complete schedule of EuroPython."""
"""Complete schedule of PyLadiesCon."""

days: dict[date, DaySchedule]


class Break(BaseModel):
"""Break in the EuroPython schedule."""
"""Break in the PyLadiesCon schedule."""

event_type: str
title: str
Expand All @@ -29,7 +29,7 @@ class Break(BaseModel):


class Session(BaseModel):
"""Session in the EuroPython schedule."""
"""Session in the PyLadiesCon schedule."""

event_type: str
code: str
Expand All @@ -40,6 +40,7 @@ class Session(BaseModel):
tweet: str
level: str
track: str | None
youtube_url: str | None # Add PyLadiesCon
rooms: list[str]
start: AwareDatetime
website_url: str
Expand Down
11 changes: 11 additions & 0 deletions src/europython_discord/program_notifications/program_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ async def fetch_schedule(self) -> None:
await f.write(json.dumps(schedule, indent=2))
_logger.info("Schedule written to cache file.")

# TODO PyLadiesCon: Here we need to modify the fetched schedule file
# and add the new field of each session 'youtube_url' from a local
# configuration file that needs to be provided once the videos are scheduled
# The file needs to have a map with 'Session Code' and the 'Youtube URL',
# for example:
# {
# 'XSRQD': 'https://youtube.com/adasdsdsad',
# }
# so later we can go to the schedule.json and find the 'code'
# field in each item inside 'events', and add it.

self.sessions_by_day = await self.parse_schedule(schedule)
_logger.info("Schedule parsed and loaded.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def create_session_embed(session: Session, livestream_url: str | None) -> Embed:
embed.add_field(name="Room", value=_format_room(session.rooms), inline=True)
embed.add_field(name="Track", value=_format_track(session.track), inline=True)
embed.add_field(name="Duration", value=_format_duration(session.duration), inline=True)
embed.add_field(name="Livestream", value=_format_live_stream(livestream_url), inline=True)
#embed.add_field(name="Livestream", value=_format_live_stream(livestream_url), inline=True)
embed.add_field(name="Livestream", value=_format_live_stream(session.youtube_url), inline=True) # Add PyLadiesCon
embed.add_field(name="Level", value=session.level.capitalize(), inline=True)

author = _create_author_from_speakers(session.speakers)
Expand Down
17 changes: 7 additions & 10 deletions src/europython_discord/registration/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

# Discord's colon-syntax `:point_left:` does not work in button labels, so we use `\N{...}` here
REGISTRATION_BUTTON_LABEL = "Register here \N{WHITE LEFT POINTING BACKHAND INDEX}"
WELCOME_MESSAGE_TITLE = "## Welcome to EuroPython 2025 on Discord! :tada::snake:"
WELCOME_MESSAGE_TITLE = "## Welcome to PyLadiesCon 2025 on Discord! :tada::snake:"


class RegistrationForm(discord.ui.Modal, title="EuroPython 2025 Registration"):
class RegistrationForm(discord.ui.Modal, title="PyLadiesCon 2025 Registration"):
def __init__(
self,
config: RegistrationConfig,
Expand All @@ -33,15 +33,15 @@ def __init__(
self.registration_logger = registration_logger

order_field = discord.ui.TextInput(
label="Order ID (As printed on your badge or ticket)",
label="Order ID (As in your ticket)",
required=True,
min_length=5,
max_length=9,
placeholder="Like '#XXXXX-X' or 'XXXXX'",
)

name_field = discord.ui.TextInput(
label="Name (As printed on your badge or ticket)",
label="Name (As in your ticket)",
required=True,
min_length=1,
max_length=50,
Expand Down Expand Up @@ -129,9 +129,7 @@ async def on_error(self, interaction: Interaction, error: Exception) -> None:
async def log_registration_to_user(interaction: Interaction, *, name: str) -> None:
await interaction.response.send_message(
f"Thank you {name}, you are now registered!\n\n"
f"Also, your nickname was changed to the name you used to register your ticket. "
f"This is also the name that would be on your conference badge, which means that "
f"your nickname can be your 'virtual conference badge'.",
f"Also, your nickname was changed to the name you used to register your ticket. ",
ephemeral=True,
delete_after=None,
)
Expand Down Expand Up @@ -205,8 +203,7 @@ async def on_ready(self) -> None:

:two: Fill in your Order ID and the name on your ticket. You can find them
* Printed on your ticket
* Printed on your badge
* In the email "[EuroPython 2025] Your order: XXXXX" from [email protected]
* In the email "[PyLadiesCon 2025] Your order: XXXXX" from [email protected]

:three: Click "Submit".

Expand All @@ -216,7 +213,7 @@ async def on_ready(self) -> None:
* In the {reg_help_channel.mention} channel
* By speaking to a volunteer in a yellow t-shirt

Enjoy our EuroPython 2025 Community Server! :snake::computer::tada:
Enjoy our PyLadiesCon 2025 Community Server! :snake::computer::tada:
"""
)

Expand Down
Loading