Browse Source

worked on stuff

master
Antoine COMBET 3 years ago
parent
commit
6ca96de969
  1. 4
      .gitignore
  2. 0
      app/Commands.hs
  3. 28
      app/Main.hs
  4. 1
      botiut.cabal

4
.gitignore

@ -1,2 +1,4 @@
dist-newstyle
*.secret
*.secret
*#
.#*

0
app/Commands.hs

28
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

1
botiut.cabal

@ -34,5 +34,6 @@ executable botiut
, control-event
, text
, unliftio
, iCalendar
hs-source-dirs: app
default-language: Haskell2010
Loading…
Cancel
Save