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 :: Config -> Maybe CreateApplicationCommand
edtCommand c = edtCommand c =
createChatInput "edt" "Gets the planning for a group"
createChatInput "edt" "Affiche l'emploi du temps"
>>= \cac -> return $ cac >>= \cac -> return $ cac
{ createOptions = { createOptions =
Just $ OptionsValues Just $ OptionsValues
[ OptionValueString [ OptionValueString
"group" "group"
Nothing Nothing
"The group for which the planning is requested"
"Le groupe pour lequel afficher l'emploi du temps"
Nothing Nothing
True True
(Right $ map (\x -> Choice x Nothing x) $ groupNames c) (Right $ map (\x -> Choice x Nothing x) $ groupNames c)
@ -77,7 +77,7 @@ edtCommand c =
, OptionValueString , OptionValueString
"day" "day"
Nothing 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 Nothing
False False
(Left False) (Left False)
@ -106,11 +106,11 @@ edtResponse _ _ = return $ interactionResponseBasic
remindCommand :: Maybe CreateApplicationCommand remindCommand :: Maybe CreateApplicationCommand
remindCommand = remindCommand =
createChatInput "remind" "reminds you of something later on"
createChatInput "remind" "Crée un rapel pour plus tard"
>>= \cac -> return $ cac >>= \cac -> return $ cac
{ createOptions = { createOptions =
Just $ OptionsValues 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 , OptionValueString "message" Nothing "message" Nothing True (Left False) Nothing Nothing
] ]
} }
@ -151,9 +151,9 @@ remindResponse (Just (OptionsDataValues opts)) evts ch mou
liftIO $ registerRemind rmd liftIO $ registerRemind rmd
return return
$ interactionResponseBasic $ interactionResponseBasic
$ "Reminder registered sucessfully for "
$ "Rappel enregistré avec succes pour le "
`T.append` T.pack (show remindDateTime) `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 where
parsedOpts = Map.fromList $ map parseOpt opts parsedOpts = Map.fromList $ map parseOpt opts
delay' = delay' =
@ -201,7 +201,7 @@ groupResponse c mou gid (Just (OptionsDataValues opts))
restCall $ AddGuildMemberRole gid uid rid restCall $ AddGuildMemberRole gid uid rid
return return
$ interactionResponseBasic $ interactionResponseBasic
$ "You are now part of group "
$ "Vous faîtes désormait partie du groupe "
`T.append` group `T.append` group
where where
group = group =
@ -221,8 +221,8 @@ helpResponse :: IO InteractionResponse
helpResponse = helpResponse =
return return
. interactionResponseBasic . 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 = message =
case case
(case cal of (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 } : _, _) -> Right (vcal@IT.VCalendar { IT.vcEvents = evm } : _, _) ->
TS.unlines TS.unlines
. map . map
@ -64,10 +64,10 @@ getEdt conf@Config {..} opts = do
. map snd . map snd
. Map.toList . Map.toList
$ evm $ evm
_ -> "An unexpected error has occured"
_ -> "Une erreur innatendue a survenue :/"
) )
of of
"" -> "No classes for the selected period"
"" -> "Aucune classe pour la periode en cours"
s -> s s -> s
return message return message
where where
@ -122,7 +122,7 @@ renderEvents tz = TS.unlines . map renderEvent
where where
renderEvent :: IT.VEvent -> TS.Text renderEvent :: IT.VEvent -> TS.Text
renderEvent ev = TS.pack $ printf 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.todHour $ startT ev)
(DT.todMin $ startT ev) (DT.todMin $ startT ev)
(DT.todHour $ endT ev) (DT.todHour $ endT ev)
@ -152,15 +152,15 @@ renderEvents tz = TS.unlines . map renderEvent
room _ = "Unknown" room _ = "Unknown"
teacher :: IT.VEvent -> String teacher :: IT.VEvent -> String
teacher IT.VEvent { veDescription = Just IT.Description { descriptionValue = val } } 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 where
teacher' = if uncurry (>) (Ar.bounds marray) teacher' = if uncurry (>) (Ar.bounds marray)
then "Unknown"
then "Inconnu"
else fst . last . Ar.elems $ marray else fst . last . Ar.elems $ marray
marray = if null matches then Ar.listArray (1, 0) [] else head matches marray = if null matches then Ar.listArray (1, 0) [] else head matches
matches = Re.matchAllText teacherRe $ T.unpack val matches = Re.matchAllText teacherRe $ T.unpack val
teacher _ = "Unknown"
teacher _ = "Inconnu"
teacherRe = Re.makeRegexOpts Re.compMultiline teacherRe = Re.makeRegexOpts Re.compMultiline
Re.execBlank Re.execBlank
("^\\n\\n.+\\n(.+)\\n" :: String) ("^\\n\\n.+\\n(.+)\\n" :: String)

2
app/Commands/Reminds.hs

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

4
app/Main.hs

@ -85,7 +85,7 @@ main = do
onDiscordStart :: Config -> E.EventSystem -> Discord.DiscordHandler () onDiscordStart :: Config -> E.EventSystem -> Discord.DiscordHandler ()
onDiscordStart conf@Config {..} eventSystem = do onDiscordStart conf@Config {..} eventSystem = do
let activity :: Activity let activity :: Activity
activity = Discord.def { activityName = "Doing stuff"
activity = Discord.def { activityName = "/help"
, activityType = ActivityTypeGame , activityType = ActivityTypeGame
, activityUrl = Nothing , activityUrl = Nothing
} }
@ -162,7 +162,7 @@ onDiscordEvent conf@Config {..} eventSystem (InteractionCreate InteractionApplic
"group" -> groupResponse conf user guild opts "group" -> groupResponse conf user guild opts
"help" -> liftIO helpResponse "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 () onDiscordEvent _ _ _ = return ()
pushgroupedt :: Config -> T.Text -> [(T.Text, Group)] -> Discord.DiscordHandler () pushgroupedt :: Config -> T.Text -> [(T.Text, Group)] -> Discord.DiscordHandler ()

Loading…
Cancel
Save