From 6ca96de9692634e7dd635e3644e530393859c4cc Mon Sep 17 00:00:00 2001 From: Antoine COMBET Date: Sat, 5 Feb 2022 15:32:56 +0100 Subject: [PATCH] worked on stuff --- .gitignore | 4 +++- app/Commands.hs | 0 app/Main.hs | 28 +++++++++------------------- botiut.cabal | 1 + 4 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 app/Commands.hs diff --git a/.gitignore b/.gitignore index 046a308..a80a946 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ dist-newstyle -*.secret \ No newline at end of file +*.secret +*# +.#* \ No newline at end of file diff --git a/app/Commands.hs b/app/Commands.hs new file mode 100644 index 0000000..e69de29 diff --git a/app/Main.hs b/app/Main.hs index 8f06d15..fd9bc91 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -2,19 +2,19 @@ module Main where -import Control.Monad +import Control.Monad (when, void) import qualified Data.Text as T import qualified Data.Text.IO as TIO -import UnliftIO (liftIO) +import UnliftIO (liftIO) import Discord import Discord.Types import qualified Discord.Requests as R -cmdPrefix :: T.Text -cmdPrefix = "%" +import Commands +import Discord.Internal.Rest (Activity(Activity)) main :: IO () main = do @@ -29,22 +29,12 @@ main = do TIO.putStrLn err onDiscordStart :: DiscordHandler () -onDiscordStart = undefined +onDiscordStart = do + let activity = + Activity + { + } onDiscordEvent :: Event -> DiscordHandler () -onDiscordEvent (MessageCreate m) = when (not (fromBot m) && isCommand m) $ do - let content = messageContent m - let elements = T.words content - case head elements of - _ -> unknownCommand m elements - return () onDiscordEvent _ = return () -fromBot :: Message -> Bool -fromBot = userIsBot . messageAuthor - -unknownCommand :: Message -> [Text] -> DiscordHandler () -unknownCommand = - -isCommand :: Message ->Bool -isCommand = (cmdPrefix `T.isPrefixOf`) . messageContent diff --git a/botiut.cabal b/botiut.cabal index cb23917..22b6938 100644 --- a/botiut.cabal +++ b/botiut.cabal @@ -34,5 +34,6 @@ executable botiut , control-event , text , unliftio + , iCalendar hs-source-dirs: app default-language: Haskell2010