Compare commits
10 Commits
a7e475a603
...
b2d77abf3f
Author | SHA1 | Date |
---|---|---|
|
b2d77abf3f | |
|
05667250de | |
|
fbb1bcbce2 | |
|
484146e4cb | |
|
b38a2fb5cd | |
|
2e77d0eb9b | |
|
a5c891d155 | |
|
be6fe442dd | |
|
b257f8dc2e | |
|
8044a7600a |
|
@ -1,2 +1,3 @@
|
|||
/__pycache__
|
||||
/.env
|
||||
/edt.png
|
BIN
colloscope.xlsx
BIN
colloscope.xlsx
Binary file not shown.
|
@ -12,7 +12,26 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navigation -->
|
||||
<nav>
|
||||
<div class="nav-wrapper">
|
||||
<a href="#" class="brand-logo">Staticky</a>
|
||||
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||
<li><a href="#">Home</a></li>
|
||||
<li><a href="#">About</a></li>
|
||||
<li><a href="#">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Header -->
|
||||
<header class="center-align">
|
||||
<h1>Welcome to Staticky</h1>
|
||||
<p>Your go-to solution for static websites</p>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col s12 m6">
|
||||
<div class="card blue-grey darken-1">
|
||||
|
@ -28,9 +47,34 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="page-footer">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col l6 s12">
|
||||
<h5 class="white-text">Staticky</h5>
|
||||
<p class="grey-text text-lighten-4">Your go-to solution for static websites.</p>
|
||||
</div>
|
||||
<div class="col l4 offset-l2 s12">
|
||||
<h5 class="white-text">Links</h5>
|
||||
<ul>
|
||||
<li><a class="grey-text text-lighten-3" href="#">Home</a></li>
|
||||
<li><a class="grey-text text-lighten-3" href="#">About</a></li>
|
||||
<li><a class="grey-text text-lighten-3" href="#">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-copyright">
|
||||
<div class="container">
|
||||
© 2023 Staticky
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!--JavaScript at end of body for optimized loading-->
|
||||
<script type="text/javascript" src="js/materialize.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
174
main.py
174
main.py
|
@ -2,6 +2,7 @@ from datetime import datetime
|
|||
import discord
|
||||
from discord import app_commands
|
||||
from parse_colles import create_colloscope
|
||||
from parse_salles import create_edt, parse_edt, create_image
|
||||
import os
|
||||
from dotenv import load_dotenv, dotenv_values
|
||||
import random as rng
|
||||
|
@ -17,23 +18,51 @@ tree = app_commands.CommandTree(bot)
|
|||
exclusions = ["dire", "dis", "disons", "dites", "dîtes", "dit"]
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
# Événement lorsque le bot est prêt
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
await tree.sync(guild=discord.Object(id=1292935532472565852))
|
||||
|
||||
print(f'Connecté en tant que {bot.user.name}')
|
||||
print(f"Connecté en tant que {bot.user.name}")
|
||||
|
||||
botactivity = discord.Streaming(url="https://twitch.tv/marsisus", name=" l'exiiistence.")
|
||||
botactivity = discord.Streaming(
|
||||
url="https://twitch.tv/marsisus", name=" l'exiiistence."
|
||||
)
|
||||
await bot.change_presence(activity=botactivity)
|
||||
|
||||
|
||||
async def hour_autocomplete(
|
||||
interaction: discord.Interaction,
|
||||
current: str,
|
||||
) -> list[app_commands.Choice[str]]:
|
||||
hours = ["8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"]
|
||||
return [
|
||||
app_commands.Choice(name=hour, value=hour)
|
||||
for hour in hours
|
||||
if current.lower() in hour.lower()
|
||||
]
|
||||
|
||||
|
||||
async def day_autocomplete(
|
||||
interaction: discord.Interaction,
|
||||
current: str,
|
||||
) -> list[app_commands.Choice[str]]:
|
||||
days = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]
|
||||
return [
|
||||
app_commands.Choice(name=day, value=day)
|
||||
for day in days
|
||||
if current.lower() in day.lower()
|
||||
]
|
||||
|
||||
|
||||
# réagir a un message
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
if message.author == bot.user:
|
||||
return
|
||||
|
||||
if "quoi" in message.content[-10:].lower():
|
||||
r = rng.randint(0,1000)
|
||||
if r == 1 :
|
||||
|
@ -41,18 +70,26 @@ async def on_message(message):
|
|||
else :
|
||||
await message.channel.send(f"FEUUR {message.author.mention} !!!")
|
||||
if "j'aime" in message.content.lower()[:6]:
|
||||
await message.author.edit(nick=f'{message.content[6:]}')
|
||||
await message.author.edit(nick=f"{message.content[6:]}")
|
||||
|
||||
for i in range(len(message.content.split())):
|
||||
if message.channel.id == 1292943453423931493 or message.channel.id == 1304556681774239784:
|
||||
return
|
||||
if message.content.lower().split()[i] in exclusions:
|
||||
continue;
|
||||
continue
|
||||
if len(message.content.split()[i]) < 4:
|
||||
continue
|
||||
if "dis" in message.content.lower().split()[i][:3] or "dit" in message.content.lower().split()[i][:3]:
|
||||
if (
|
||||
"dis" in message.content.lower().split()[i][:3]
|
||||
or "dit" in message.content.lower().split()[i][:3]
|
||||
):
|
||||
await message.channel.send(f"{message.content.split()[i][3:]}")
|
||||
elif "cri" in message.content.lower().split()[i][:3]:
|
||||
await message.channel.send(f"{message.content.upper().split()[i][3:]}")
|
||||
elif "di" in message.content.lower().split()[i][:2] or "dy" in message.content.lower().split()[i][:2]:
|
||||
elif (
|
||||
"di" in message.content.lower().split()[i][:2]
|
||||
or "dy" in message.content.lower().split()[i][:2]
|
||||
):
|
||||
await message.channel.send(f"{message.content.split()[i][2:]}")
|
||||
|
||||
|
||||
|
@ -60,80 +97,141 @@ async def on_message(message):
|
|||
@tree.command(
|
||||
name="parse_colles",
|
||||
description="Récupérer un fichier en .ics contenant vos colles du S1",
|
||||
guild=discord.Object(id=1292935532472565852)
|
||||
guild=discord.Object(id=1292935532472565852),
|
||||
)
|
||||
@app_commands.describe(group="Votre Groupe de Colles. (1-16)")
|
||||
@app_commands.describe(timezone = "Le fuseau Horaire UTC+n (laisser vide si vous ne savez pas), UTC+2 par défaut")
|
||||
async def recup_colles(interaction:discord.Interaction, group:str, timezone:str = "Europe/Paris"):
|
||||
@app_commands.describe(
|
||||
timezone="Le fuseau Horaire UTC+n (laisser vide si vous ne savez pas), UTC+2 par défaut"
|
||||
)
|
||||
async def recup_colles(
|
||||
interaction: discord.Interaction, group: str, timezone: str = "Europe/Paris"
|
||||
):
|
||||
if 0 < int(group) < 17:
|
||||
create_colloscope(int(group), timezone)
|
||||
await interaction.response.send_message(content=f"Voici le fichier de colles parsé pour le groupe {group} ! ", file=discord.File("output.ics", filename=f"groupe{group}.ics") )
|
||||
await interaction.response.send_message(
|
||||
content=f"Voici le fichier de colles parsé pour le groupe {group} ! ",
|
||||
file=discord.File("output.ics", filename=f"groupe{group}.ics"),
|
||||
)
|
||||
else:
|
||||
await interaction.response.send_message(content="Ce groupe n'existe pas banane !")
|
||||
await interaction.response.send_message(
|
||||
content="Ce groupe n'existe pas banane !"
|
||||
)
|
||||
|
||||
|
||||
@tree.command(
|
||||
name="free_rooms",
|
||||
description="Trouver les salles libres à un moment donné",
|
||||
guild=discord.Object(id=1292935532472565852),
|
||||
)
|
||||
@app_commands.describe(hour="L'heure de la journée (par défault maintenant) (sans le h)")
|
||||
@app_commands.autocomplete(hour=hour_autocomplete)
|
||||
@app_commands.describe(day="Le jour de la semaine (par défault aujourd'hui)")
|
||||
@app_commands.autocomplete(day=day_autocomplete)
|
||||
@app_commands.describe(room="(FACULTATIF) Si vous souhaitez une salle en particulier")
|
||||
async def recup_edt(
|
||||
interaction: discord.Interaction,
|
||||
day: str = datetime.now().strftime("%A"),
|
||||
hour: str = datetime.now().strftime("%H"),
|
||||
room: str = "",
|
||||
):
|
||||
if 8 <= int(hour) <= 18:
|
||||
free_rooms = create_edt(int(hour), 1, day.capitalize())
|
||||
# embeds = parse_edt(sorted(free_rooms), hour, day.capitalize())
|
||||
# await interaction.response.send_message(embed=embeds[0])
|
||||
# if len(embeds) == 2:
|
||||
# await interaction.followup.send(embed=embeds[1])
|
||||
if room == "":
|
||||
create_image(free_rooms, hour, day.capitalize())
|
||||
await interaction.response.send_message(file=discord.File("edt.png"))
|
||||
else:
|
||||
for salle in free_rooms:
|
||||
if salle[0] == room:
|
||||
await interaction.response.send_message(
|
||||
content=f"La salle {room} est libre à {hour}h le {day}!"
|
||||
)
|
||||
return
|
||||
await interaction.response.send_message(
|
||||
content=f"La salle {room} n'est pas libre à {hour}h le {day}!"
|
||||
)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
await interaction.response.send_message(
|
||||
content=f"Je ne connais pas {hour} heure(s)..."
|
||||
)
|
||||
|
||||
|
||||
# Slash command to get help
|
||||
@tree.command(
|
||||
name="help",
|
||||
description="Afficher l'aide",
|
||||
guild=discord.Object(id=1292935532472565852)
|
||||
|
||||
guild=discord.Object(id=1292935532472565852),
|
||||
)
|
||||
async def help(interaction: discord.Interaction):
|
||||
embed = discord.Embed(title="Le Bot des MP2I[3]",
|
||||
embed = discord.Embed(
|
||||
title="Le Bot des MP2I[3]",
|
||||
url="https://staticky.marsisus.me",
|
||||
description="""
|
||||
Bienvenue sur la page d'aide du bot !
|
||||
Voici les commandes disponibles :
|
||||
- `/parse_colles [groupe] {timezone}`
|
||||
: Récupérer un fichier en .ics contenant vos colles du S1
|
||||
- `/free_rooms {jour} {heure}`
|
||||
: Trouver les salles libres à un moment donné
|
||||
- `/help` : Afficher l'aide""",
|
||||
colour=0x00b0f4,
|
||||
timestamp=datetime.now())
|
||||
colour=0x00B0F4,
|
||||
timestamp=datetime.now(),
|
||||
)
|
||||
|
||||
embed.set_author(name="Staticky",
|
||||
url="https://staticky.marsisus.me",)
|
||||
embed.set_author(
|
||||
name="Staticky",
|
||||
url="https://staticky.marsisus.me",
|
||||
)
|
||||
|
||||
await interaction.response.send_message(embed=embed, ephemeral=True)
|
||||
|
||||
|
||||
async def hour_autocomplete(
|
||||
interaction: discord.Interaction,
|
||||
current: str,
|
||||
) -> list[app_commands.Choice[str]]:
|
||||
hours = ["13", "14", "15", "16", "17", '18']
|
||||
return [
|
||||
app_commands.Choice(name=hour, value=hour)
|
||||
for hour in hours if current.lower() in hour.lower()
|
||||
]
|
||||
|
||||
|
||||
# Slash command to add a colle to the marketplace
|
||||
@tree.command(
|
||||
name="add_colle",
|
||||
description="!!NE FONCTIONNE PAS !! Ajoute une collle au marketplace",
|
||||
guild=discord.Object(id=1292935532472565852)
|
||||
|
||||
guild=discord.Object(id=1292935532472565852),
|
||||
)
|
||||
@app_commands.describe(group="Votre Groupe de Colles. (1-16)")
|
||||
@app_commands.describe(day="Format: JJ/MM/AAAA, bien réspécter le format")
|
||||
@app_commands.describe(hour = "L'heure de la colle, sans le \"h\"")
|
||||
@app_commands.describe(hour='L\'heure de la colle, sans le "h"')
|
||||
@app_commands.autocomplete(hour=hour_autocomplete)
|
||||
@app_commands.describe(teacher="Le nom du professeur")
|
||||
@app_commands.describe(subject = "La matière de la colle (Maths, Physique, Anglais, Lettres)")
|
||||
@app_commands.describe(
|
||||
subject="La matière de la colle (Maths, Physique, Anglais, Lettres)"
|
||||
)
|
||||
# @app_commands.autocomplete(subject=["Maths", "Physique", "Anglais", "Lettres"])
|
||||
@app_commands.describe(room="La salle de la colle")
|
||||
# @app_commands.autocomplete(group=["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"])
|
||||
|
||||
async def add_colle(interaction:discord.Interaction, group:str, day:str, hour:str, teacher:str, subject:str, room:str):
|
||||
|
||||
async def add_colle(
|
||||
interaction: discord.Interaction,
|
||||
group: str,
|
||||
day: str,
|
||||
hour: str,
|
||||
teacher: str,
|
||||
subject: str,
|
||||
room: str,
|
||||
):
|
||||
# "ASSERTIONS" A IMPLEMENTER !!!!
|
||||
embed = discord.Embed(title=f"Colle de {subject}",
|
||||
embed = discord.Embed(
|
||||
title=f"Colle de {subject}",
|
||||
description=f"Date : {day} {hour}h00\nProfesseur : {teacher}\nSalle : {room}\n Groupe : {group}\n\n! ENCORE EN PHASE DE TEST ! NON FONCTIONNEL !",
|
||||
colour=0xf50083,
|
||||
timestamp=datetime.now())
|
||||
colour=0xF50083,
|
||||
timestamp=datetime.now(),
|
||||
)
|
||||
|
||||
embed.set_author(name=f"{interaction.user.name}")
|
||||
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
|
||||
# Lancer le bot
|
||||
bot.run(os.getenv('BOT_TOKEN'))
|
||||
bot.run(os.getenv("BOT_TOKEN"))
|
||||
|
|
490
output.ics
490
output.ics
|
@ -2,255 +2,273 @@ BEGIN:VCALENDAR
|
|||
VERSION:2.0
|
||||
PRODID:ics.py - http://git.io/lLljaA
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Belaggoune\nSalle: C452\nMatière : Anglais
|
||||
DESCRIPTION:Professeur: Mme Mann\nSalle: C389\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C452 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241128T160000Z
|
||||
LOCATION:C389 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241120T150000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:d8d0ee04-6e44-4561-a6bc-17577ee9e23e@d8d0.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Poupy\nSalle: R028\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R028 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250129T170000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:afb1b0ee-b72a-408f-b42e-20ad2ae67b68@afb1.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chibani\nSalle: C284\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C284 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20240927T140000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:82ae2b31-2f44-4439-a662-e47a675c46ff@82ae.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Kidscheid\nSalle: C393\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C393 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241211T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:af15ab76-98d2-47e4-9369-93928d2471b5@af15.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Sabban\nSalle: M103\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:M103 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241108T160000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:dcb42c70-3a92-4dc2-a652-244be92046e9@dcb4.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mullaert\nSalle: C381\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C381 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250131T130000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:8e2c3e73-4262-48d7-80fb-cfb60f67e6b9@8e2c.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Cissokho\nSalle: C283\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C283 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241018T140000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:22557d16-9ef5-49bc-8402-cdd482125cbb@2255.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Gallic\nSalle: C384\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C384 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241114T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:ba593459-8b96-4078-a30e-b950f95f5e48@ba59.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chevalier\nSalle: R011\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R011 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241205T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:2ffcb858-ade1-4e2a-bab4-72c06fc5578a@2ffc.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Sabban\nSalle: M103\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:M103 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250110T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:06b23272-eb32-4080-b323-f3dd8b726a97@06b2.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Gauvin\nSalle: C387\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C387 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250106T170000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:1b070264-ac01-4dfc-8298-642bade283ea@1b07.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Annoussamy\nSalle: C454\nMatière : Lettres
|
||||
DURATION:PT1H
|
||||
LOCATION:C454 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241106T170000Z
|
||||
SUMMARY:Colle Lettres
|
||||
UID:bc8f17ab-0bdc-4c7c-a99d-dcf8c70fccd2@bc8f.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Annoussamy\nSalle: C454\nMatière : Lettres
|
||||
DURATION:PT1H
|
||||
LOCATION:C454 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250122T170000Z
|
||||
SUMMARY:Colle Lettres
|
||||
UID:580a3ee0-b06d-4d63-896a-a88020f378c6@580a.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Pelletier\nSalle: C396\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C396 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250116T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:7fc6fa92-ed51-4da3-8ac7-054c7ff39d87@7fc6.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chibani\nSalle: C284\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C284 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250117T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:24438d8b-a45c-4327-adf6-ef84d55a1a44@2443.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Gallic\nSalle: C384\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C384 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241219T170000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:7fdcc294-3676-4ada-bf7f-e9005e37149f@7fdc.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Kidscheid\nSalle: C393\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C393 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241016T130000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:746faaff-7bd1-47b7-92e6-100a7be1b482@746f.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Cissokho\nSalle: C283\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C283 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241206T160000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:9fc067a1-9a7c-4750-aa43-771afd93b5de@9fc0.org
|
||||
UID:413cc783-5912-4123-b6a6-0dacf110b61c@413c.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Bouverot\nSalle: M103\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:M103 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241009T120000Z
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241127T130000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:bbeadb6a-3010-4007-b121-047a5972c553@bbea.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Poupy\nSalle: R028\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R028 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241009T160000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:d9589a1e-12f9-40ab-b285-a312d92ba6a8@d958.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chibani\nSalle: C284\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C284 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241220T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:989cb0d8-96ff-436f-9bd2-9dccc37e1db4@989c.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Lattanzio\nSalle: C391\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C391 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20250122T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:bed126ca-f3a0-4bc9-8fac-e5119db367f7@bed1.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Kidscheid\nSalle: C393\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C393 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241002T130000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:783b94c3-a8fc-41e5-8308-1fa82b1ddbc5@783b.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Robin\nSalle: C394\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C394 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241120T170000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:69fe161d-a2e0-40e4-9493-2eb70e3d0439@69fe.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Lattanzio\nSalle: C391\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C391 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241113T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:3fa16e00-1aab-4f50-8d29-088036ac0d0e@3fa1.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mullaert\nSalle: C381\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C381 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241004T130000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:10810fa9-b683-4e12-930c-bde580f18474@1081.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Poupy\nSalle: R028\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R028 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241106T160000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:55fdfd68-9099-41cb-a2d1-dae1a80ef901@55fd.org
|
||||
UID:9668a708-9ef4-4d68-99d9-f32cfa945309@9668.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Lé-Nhu\nSalle: C383\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C383 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 2:mailto:Groupe 2
|
||||
DTSTART:20241212T160000Z
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241205T160000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:c7cdf6a3-1d72-45c3-95d7-5c3a500db5f1@c7cd.org
|
||||
UID:7193e8f2-a3a5-4ce9-b505-2468285d495f@7193.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Poupy\nSalle: R028\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R028 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241113T170000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:268f8534-c199-4579-bafd-8ce7a66dc2cf@268f.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Pelletier\nSalle: C396\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C396 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241003T140000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:d4c8525b-33a8-487c-be26-59054884ef9d@d4c8.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Semenova\nSalle: C395\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C395 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241204T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:a17f544e-d96a-4527-9c8f-cbcfab35c04c@a17f.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Gallic\nSalle: C384\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C384 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250116T170000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:9b387f77-f41e-4dff-9c2a-8e54e26ec19b@9b38.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Lattanzio\nSalle: C391\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C391 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250129T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:bf694860-769a-4bbd-a777-2851916f3692@bf69.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mann\nSalle: C389\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C389 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241009T150000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:9de4ebfb-cb28-4c9a-abd6-ab94504842d5@9de4.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Cissokho\nSalle: C283\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C283 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241115T160000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:5e57a87a-21b9-44f3-903e-e6d7cf542521@5e57.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Poupy\nSalle: R028\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R028 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241127T160000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:c7f6a698-6e21-4f52-9124-ca52bdb51e51@c7f6.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mullaert\nSalle: C381\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C381 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241213T130000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:95b53ac6-b26f-458d-a081-a09388af47fd@95b5.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chevalier\nSalle: R011\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R011 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250109T160000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:57aa17b3-cee7-4ece-9f00-89f8b0f66f77@57aa.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chibani\nSalle: C284\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C284 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241018T140000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:a0bad9fe-e694-4a9b-a138-a529314e8f93@a0ba.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Sabban\nSalle: M103\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:M103 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241018T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:0d789b19-8a26-4c80-b875-8345619bff7c@0d78.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chevalier\nSalle: R011\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R011 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241212T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:09128e81-e297-43bd-98c0-9073e93f88fd@0912.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mann\nSalle: C389\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C389 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20240925T150000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:72cc7062-d7e7-4c3e-9de4-5ab527bce37c@72cc.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Cissokho\nSalle: C283\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C283 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241011T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:f3de9cfc-a048-45b2-af0f-5c72703c6831@f3de.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Mullaert\nSalle: C381\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C381 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241122T140000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:159ce887-38f5-4eaf-b96c-5b22a8012edc@159c.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Semenova\nSalle: C395\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C395 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250115T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:d5652f7a-c9f5-4805-bb92-4277c4976b19@d565.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Lé-Nhu\nSalle: C383\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C383 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250109T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:82a2c59c-b0f7-4212-b131-00dfcaa81c47@82a2.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Gallic\nSalle: C384\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C384 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20240926T140000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:e57dfda2-51b5-4f7a-a5d7-be0aacf1fc2d@e57d.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Kidscheid\nSalle: C393\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C393 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241106T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:a1ce1daa-ec83-4d5b-b702-cf7db5541ad1@a1ce.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Cissokho\nSalle: C283\nMatière : Maths
|
||||
DURATION:PT1H
|
||||
LOCATION:C283 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250124T150000Z
|
||||
SUMMARY:Colle Maths
|
||||
UID:b5771b2d-1813-4d51-8424-7619690fc99b@b577.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Lattanzio\nSalle: C391\nMatière : Anglais
|
||||
DURATION:PT1H
|
||||
LOCATION:C391 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241218T140000Z
|
||||
SUMMARY:Colle Anglais
|
||||
UID:9ceca751-9004-4d15-b01e-9ec36bd6ab21@9cec.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chevalier\nSalle: R011\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R011 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20240919T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:cfb37b62-434b-4c42-a1fc-be3a14949311@cfb3.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Annoussamy\nSalle: C454\nMatière : Lettres
|
||||
DURATION:PT1H
|
||||
LOCATION:C454 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241106T160000Z
|
||||
SUMMARY:Colle Lettres
|
||||
UID:92301b34-aa95-4adf-bec7-01b8b381880b@9230.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: M. Annoussamy\nSalle: C454\nMatière : Lettres
|
||||
DURATION:PT1H
|
||||
LOCATION:C454 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250129T150000Z
|
||||
SUMMARY:Colle Lettres
|
||||
UID:45d97141-4462-49f8-b278-af4044515ac0@45d9.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chevalier\nSalle: R011\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:R011 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20250123T150000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:32ab30dd-129e-413f-abfd-e762dbd7a0a5@32ab.org
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Professeur: Mme Chibani\nSalle: C284\nMatière : Physique
|
||||
DURATION:PT1H
|
||||
LOCATION:C284 - Saint-Louis
|
||||
ORGANIZER;CN=Groupe 13:mailto:Groupe 13
|
||||
DTSTART:20241004T140000Z
|
||||
SUMMARY:Colle Physique
|
||||
UID:d665a237-2b1a-4094-83ff-f5c8c9a05236@d665.org
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
|
@ -10,6 +10,7 @@ from ics import Calendar, Event
|
|||
def create_colloscope(groupe:int, timezone:str = "Europe/Paris"):
|
||||
try:
|
||||
pytz.timezone(timezone)
|
||||
timezone = timezone
|
||||
except pytz.UnknownTimeZoneError:
|
||||
timezone = "Europe/Paris"
|
||||
c = Calendar()
|
||||
|
@ -52,7 +53,11 @@ def create_colloscope(groupe:int, timezone:str = "Europe/Paris"):
|
|||
continue
|
||||
day_sem = str(day_sem).split(" ")[0]
|
||||
days = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']
|
||||
days_english = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
|
||||
try:
|
||||
day_number_sem = days.index(day_sem)
|
||||
except ValueError:
|
||||
day_number_sem = days_english.index(day_sem)
|
||||
|
||||
# Combine day_number_sem with date
|
||||
new_days = day_number_sem + date.day;
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
import openpyxl
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import discord
|
||||
from discord import app_commands, Embed
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
def create_edt(heure:int, semestre:int, day:int) -> list[int]:
|
||||
|
||||
days = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']
|
||||
days_english = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
|
||||
try:
|
||||
day_number_sem = days.index(day)
|
||||
except ValueError:
|
||||
day_number_sem = days_english.index(day)
|
||||
workbook = openpyxl.load_workbook('edt salles.xlsx')
|
||||
|
||||
sheet = workbook['EDT']
|
||||
|
||||
# Retrieve all coordinates where the cell value is 10
|
||||
coordinates = []
|
||||
for cell in sheet[3 + (heure - 8) + 11*day_number_sem][1:]:
|
||||
val = cell.value
|
||||
if val is None or ("0" not in val and "O" not in val and "S1" not in val):
|
||||
try:
|
||||
temp = sheet.cell(row=1, column=cell.column).value
|
||||
if temp is not None:
|
||||
coordinates.append((temp, sheet.cell(row=2, column=cell.column).value))
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
return coordinates
|
||||
|
||||
|
||||
def set_value(type, hour) -> str:
|
||||
if type == "Amphi":
|
||||
return "🧪 Amphi"
|
||||
if type == "TP":
|
||||
return "🔬 TP"
|
||||
if type == "Info":
|
||||
return "💻 Info"
|
||||
if type == "Colle":
|
||||
return "📖 Colle"
|
||||
if type == "Classe":
|
||||
return "🎓 Classe"
|
||||
if type == "?":
|
||||
return "❓ Inconnu"
|
||||
else:
|
||||
return ""
|
||||
def create_image(coordinates, hour, day):
|
||||
# Create a larger blank image with a custom background color
|
||||
img = Image.new('RGB', (800, 5000), color=(60, 63, 65))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Load a less formal and slightly larger font
|
||||
font = ImageFont.truetype("font.ttf", 45)
|
||||
title_font = ImageFont.truetype("font.ttf", 55)
|
||||
|
||||
# Title
|
||||
title = f"EDT : {hour}h - {day}"
|
||||
draw.text((400 - (draw.textbbox((0, 0), title, font=title_font)[2] - draw.textbbox((0, 0), title, font=title_font)[0]) // 2, 20), title, fill="white", font=title_font)
|
||||
|
||||
# Description
|
||||
description = f"Liste des Salles disponibles à {hour}h"
|
||||
draw.text((400 - (draw.textbbox((0, 0), description, font=font)[2] - draw.textbbox((0, 0), description, font=font)[0]) // 2, 80), description, fill="white", font=font)
|
||||
|
||||
# Draw the table header with a different color
|
||||
header = ["Salle", "Type"]
|
||||
x_text = [200, 600]
|
||||
for i, h in enumerate(header):
|
||||
draw.text((x_text[i] - (draw.textbbox((0, 0), h, font=font)[2] - draw.textbbox((0, 0), h, font=font)[0]) // 2, 140), h, fill="white", font=font)
|
||||
|
||||
# Define background colors for each type of room
|
||||
type_colors = {
|
||||
"Amphi": (255, 153, 153),
|
||||
"TP": (153, 204, 255),
|
||||
"Info": (255, 204, 204),
|
||||
"Colle": (255, 255, 153),
|
||||
"Classe": (255, 229, 153),
|
||||
"?": (224, 224, 224)
|
||||
}
|
||||
|
||||
# Sort coordinates by room type
|
||||
coordinates.sort(key=lambda x: x[1])
|
||||
|
||||
# Draw the coordinates in a table format with alternating row colors
|
||||
y_text = 200
|
||||
line_height = 45
|
||||
padding = 8
|
||||
for i, (room, room_type) in enumerate(coordinates):
|
||||
if y_text + line_height + padding > 3000:
|
||||
break
|
||||
fill_color = type_colors.get(room_type, (150, 150, 150))
|
||||
|
||||
# Draw rounded rectangle
|
||||
draw.rounded_rectangle([(0, y_text), (800, y_text + line_height)], radius=20, fill=fill_color)
|
||||
|
||||
text_y = y_text + (line_height - font.getbbox(room)[3]) // 2
|
||||
|
||||
# Draw the room name
|
||||
draw.text((200 - (draw.textbbox((0, 0), room, font=font)[2] - draw.textbbox((0, 0), room, font=font)[0]) // 2, text_y), room, fill="black", font=font)
|
||||
|
||||
# Draw the room type in darker gray
|
||||
draw.text((600 - (draw.textbbox((0, 0), set_value(room_type, hour), font=font)[2] - draw.textbbox((0, 0), set_value(room_type, hour), font=font)[0]) // 2, text_y), set_value(room_type, hour), fill="gray", font=font)
|
||||
|
||||
y_text += line_height + padding
|
||||
|
||||
# Resize the image to fit the content
|
||||
img = img.crop((0, 0, 800, y_text))
|
||||
|
||||
img.save("edt.png")
|
||||
|
||||
def parse_edt(coordinates, hour, day):
|
||||
embeds = []
|
||||
|
||||
embed1 = discord.Embed(title=f"EDT : {hour}h - {day}",
|
||||
url="https://staticky.marsisus.me",
|
||||
description=f"Liste des Salles disponibles à {hour}h",
|
||||
timestamp=datetime.now())
|
||||
|
||||
for i in range(min(25, len(coordinates))):
|
||||
embed1.add_field(name=f"**{coordinates[i][0]}**", inline=True, value=set_value(coordinates[i][1], hour))
|
||||
embed1.set_footer(text="Made by Marsisus, Magos, Hugo, Gabriel... ")
|
||||
embeds.append(embed1)
|
||||
|
||||
if len(coordinates) > 25:
|
||||
embed2 = discord.Embed(
|
||||
timestamp=datetime.now())
|
||||
|
||||
for i in range(25, len(coordinates)):
|
||||
embed2.add_field(name=f"**{coordinates[i][0]}**", value=set_value(coordinates[i][1], hour), inline=True)
|
||||
embed2.set_footer(text="Made by Marsisus, Magos, Hugo, Gabriel... ")
|
||||
embeds.append(embed2)
|
||||
|
||||
return embeds
|
Loading…
Reference in New Issue