diff --git a/prod-config.toml b/prod-config.toml index b138e6b..6b3b314 100644 --- a/prod-config.toml +++ b/prod-config.toml @@ -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" @@ -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" diff --git a/src/europython_discord/bot.py b/src/europython_discord/bot.py index 3390f45..6222835 100644 --- a/src/europython_discord/bot.py +++ b/src/europython_discord/bot.py @@ -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() diff --git a/src/europython_discord/program_notifications/cog.py b/src/europython_discord/program_notifications/cog.py index 92a2dac..211f09a 100644 --- a/src/europython_discord/program_notifications/cog.py +++ b/src/europython_discord/program_notifications/cog.py @@ -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__) @@ -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") @@ -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 ) @@ -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: @@ -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, diff --git a/src/europython_discord/program_notifications/models.py b/src/europython_discord/program_notifications/models.py index 139eeba..65a34eb 100644 --- a/src/europython_discord/program_notifications/models.py +++ b/src/europython_discord/program_notifications/models.py @@ -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 @@ -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 @@ -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 diff --git a/src/europython_discord/program_notifications/program_connector.py b/src/europython_discord/program_notifications/program_connector.py index d1f2c65..82f9e33 100644 --- a/src/europython_discord/program_notifications/program_connector.py +++ b/src/europython_discord/program_notifications/program_connector.py @@ -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.") diff --git a/src/europython_discord/program_notifications/session_to_embed.py b/src/europython_discord/program_notifications/session_to_embed.py index c009b9e..a920211 100644 --- a/src/europython_discord/program_notifications/session_to_embed.py +++ b/src/europython_discord/program_notifications/session_to_embed.py @@ -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) diff --git a/src/europython_discord/registration/cog.py b/src/europython_discord/registration/cog.py index 8e7c8a0..4c55d64 100644 --- a/src/europython_discord/registration/cog.py +++ b/src/europython_discord/registration/cog.py @@ -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, @@ -33,7 +33,7 @@ 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, @@ -41,7 +41,7 @@ def __init__( ) 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, @@ -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, ) @@ -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 support@pretix.eu + * In the email "[PyLadiesCon 2025] Your order: XXXXX" from support@pretix.eu :three: Click "Submit". @@ -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: """ )