Browse Source

Translate to french

master
Annwan 2 years ago
parent
commit
cef3d1322f
  1. 26
      app/Commands.hs
  2. 14
      app/Commands/EDT.hs
  3. 2
      app/Commands/Reminds.hs
  4. 4
      app/Main.hs

26
app/Commands.hs

@ -62,14 +62,14 @@ pingResponse _ = return $ interactionResponseBasic "Pong"
edtCommand :: Config -> Maybe CreateApplicationCommand
edtCommand c =
createChatInput "edt" "Gets the planning for a group"
createChatInput "edt" "Affiche l'emploi du temps"
>>= \cac -> return $ cac
{ createOptions =
Just $ OptionsValues
[ OptionValueString
"group"
Nothing
"The group for which the planning is requested"
"Le groupe pour lequel afficher l'emploi du temps"
Nothing
True
(Right $ map (\x -> Choice x Nothing x) $ groupNames c)
@ -77,7 +77,7 @@ edtCommand c =
, OptionValueString
"day"
Nothing
"The day(s) for which the planning is requested (today, tomorrow, week or DD/MM/YYYY)"
"Le(s) jour(s) pour le(s)quel(s) afficher l'emploi du temps (today (aujourd'hui), tomorrow (demain), week (semaine) or JJ/MM/AAAA)"
Nothing
False
(Left False)
@ -106,11 +106,11 @@ edtResponse _ _ = return $ interactionResponseBasic
remindCommand :: Maybe CreateApplicationCommand
remindCommand =
createChatInput "remind" "reminds you of something later on"
createChatInput "remind" "Crée un rapel pour plus tard"
>>= \cac -> return $ cac
{ createOptions =
Just $ OptionsValues
[ OptionValueString "delay" Nothing "delay" Nothing True (Left False) Nothing Nothing
[ OptionValueString "delay" Nothing "délai" Nothing True (Left False) Nothing Nothing
, OptionValueString "message" Nothing "message" Nothing True (Left False) Nothing Nothing
]
}
@ -151,9 +151,9 @@ remindResponse (Just (OptionsDataValues opts)) evts ch mou
liftIO $ registerRemind rmd
return
$ interactionResponseBasic
$ "Reminder registered sucessfully for "
$ "Rappel enregistré avec succes pour le "
`T.append` T.pack (show remindDateTime)
else return $ interactionResponseBasic "couldn't parse your delay :/"
else return $ interactionResponseBasic "Le délai n'a pas pu être interprété"
where
parsedOpts = Map.fromList $ map parseOpt opts
delay' =
@ -201,7 +201,7 @@ groupResponse c mou gid (Just (OptionsDataValues opts))
restCall $ AddGuildMemberRole gid uid rid
return
$ interactionResponseBasic
$ "You are now part of group "
$ "Vous faîtes désormait partie du groupe "
`T.append` group
where
group =
@ -221,8 +221,8 @@ helpResponse :: IO InteractionResponse
helpResponse =
return
. interactionResponseBasic
$ "**__Help for Bot IUT__**\n\n"
`T.append` "`/help` shows this help message\n"
`T.append` "`/group <group>` join a group\n"
`T.append` "`/remind <time><s|m|h|d> <message>` reminds you of something in the future\n"
`T.append` "`/edt <group> [week|today|tomorrow|dd/mm/yyyy]` get the planning for group `group` on `day` (`day` defaults to `week`)"
$ "**__Aide pour Bot IUT__**\n\n"
`T.append` "`/help` afficher ce message d'aide\n"
`T.append` "`/group <group>` rejoindre un groupe\n"
`T.append` "`/remind <time><s|m|h|d> <message>` Créer un rappel pour plus tard\n"
`T.append` "`/edt <group> [week|today|tomorrow|jj/mm/aaaa]` Affiche l'emploi du temps pour le groupe `group` pour le jour `day` (`day` est `week` par défaut)"

14
app/Commands/EDT.hs

@ -43,7 +43,7 @@ getEdt conf@Config {..} opts = do
message =
case
(case cal of
Left _ -> "I don't know this group, alternatively ADE doesn't work"
Left _ -> "Je ne connaît pas ce groupe. Il se peux aussi que ADE ne fonctionne pas actuellement"
Right (vcal@IT.VCalendar { IT.vcEvents = evm } : _, _) ->
TS.unlines
. map
@ -64,10 +64,10 @@ getEdt conf@Config {..} opts = do
. map snd
. Map.toList
$ evm
_ -> "An unexpected error has occured"
_ -> "Une erreur innatendue a survenue :/"
)
of
"" -> "No classes for the selected period"
"" -> "Aucune classe pour la periode en cours"
s -> s
return message
where
@ -122,7 +122,7 @@ renderEvents tz = TS.unlines . map renderEvent
where
renderEvent :: IT.VEvent -> TS.Text
renderEvent ev = TS.pack $ printf
"*%02d:%02d → %02d:%02d* : **%s** with **%s** in **%s**"
"*%02d:%02d → %02d:%02d* : **%s** avec **%s** en **%s**"
(DT.todHour $ startT ev)
(DT.todMin $ startT ev)
(DT.todHour $ endT ev)
@ -152,15 +152,15 @@ renderEvents tz = TS.unlines . map renderEvent
room _ = "Unknown"
teacher :: IT.VEvent -> String
teacher IT.VEvent { veDescription = Just IT.Description { descriptionValue = val } }
= if '\n' `elem` teacher' then "Unknown" else teacher'
= if '\n' `elem` teacher' then "Inconnu" else teacher'
where
teacher' = if uncurry (>) (Ar.bounds marray)
then "Unknown"
then "Inconnu"
else fst . last . Ar.elems $ marray
marray = if null matches then Ar.listArray (1, 0) [] else head matches
matches = Re.matchAllText teacherRe $ T.unpack val
teacher _ = "Unknown"
teacher _ = "Inconnu"
teacherRe = Re.makeRegexOpts Re.compMultiline
Re.execBlank
("^\\n\\n.+\\n(.+)\\n" :: String)

2
app/Commands/Reminds.hs

@ -63,7 +63,7 @@ scheduleRemind ev Remind {..} = do
$ CreateMessage rmdChannel
$ "<@"
<> T.pack (show rmdUser)
<> "> **Reminder**\n"
<> "> **Rappel**\n"
<> rmdMessage
registerRemind :: Remind -> IO ()

4
app/Main.hs

@ -85,7 +85,7 @@ main = do
onDiscordStart :: Config -> E.EventSystem -> Discord.DiscordHandler ()
onDiscordStart conf@Config {..} eventSystem = do
let activity :: Activity
activity = Discord.def { activityName = "Doing stuff"
activity = Discord.def { activityName = "/help"
, activityType = ActivityTypeGame
, activityUrl = Nothing
}
@ -162,7 +162,7 @@ onDiscordEvent conf@Config {..} eventSystem (InteractionCreate InteractionApplic
"group" -> groupResponse conf user guild opts
"help" -> liftIO helpResponse
_ ->
return $ interactionResponseBasic $ "Unhandled Command: " `T.append` name
return $ interactionResponseBasic $ "Commande inconnue, merci de ping le role DevBot: " `T.append` name
onDiscordEvent _ _ _ = return ()
pushgroupedt :: Config -> T.Text -> [(T.Text, Group)] -> Discord.DiscordHandler ()

Loading…
Cancel
Save