This commit is contained in:
Simon Junod
2025-08-08 17:59:27 +02:00
parent e27b4af4ec
commit 828c4dc70e
2 changed files with 27 additions and 15 deletions

11
run.py
View File

@@ -15,8 +15,11 @@ from emojis import *
from settings import *
intents = nextcord.Intents.default()
# noinspection PyDunderSlots,PyUnresolvedReferences
intents.typing = False
# noinspection PyDunderSlots,PyUnresolvedReferences
intents.presences = False
# noinspection PyDunderSlots,PyUnresolvedReferences
intents.message_content = True
bot = nextcord.Client(intents=intents)
@@ -45,6 +48,7 @@ async def on_ready():
print(f"Écoute pour Spoutnik sur {channel.guild} > {channel.name}")
current_date = None
events_done = []
while True:
await asyncio.sleep(HEARTBEAT)
now = datetime.now()
@@ -63,7 +67,7 @@ async def on_ready():
await wordle_game.reset()
elif event[0] == SPOUTNIK:
for spoutnik_game in spoutnik_games.values():
await spoutnik_game.reset()
await spoutnik_game.reset(preset=SPOUTNIK_PRESETS[event[2]], force=False)
# Receiving a message
@@ -104,9 +108,9 @@ async def on_message(message):
output += f"{spoutnik_game.channel.guild} > {spoutnik_game.channel.name} : {spoutnik_game.target}\n"
await message.author.send(output)
if regex := re.search(r"^[sS]poutnik reset ([0-9]+)$", content_lowercase):
if regex := re.search(r"^[sS]poutnik reset ([0-9]+) (.+)$", content_lowercase):
channel_id = int(regex.group(1))
await spoutnik_games[channel_id].reset()
await spoutnik_games[channel_id].reset(preset=SPOUTNIK_PRESETS[regex.group(2).strip()], force=True)
if re.search(r"^[eE]phemeris$", content_lowercase):
embed = ephemeris.digest()
@@ -244,6 +248,7 @@ async def on_message(message):
poll = polls.Poll()
poll.owner = message.author
poll.intro = intro
letter = None
for part in parts:
if re.fullmatch(bullet, part): # the part is a bullet
letter = part[0].lower()