Browse Source

rename to sephibot

master
soupi 1 year ago
parent
commit
ed7e58f385
5 changed files with 17 additions and 16 deletions
  1. +9
    -6
      app/Main.hs
  2. +5
    -7
      package.yaml
  3. +1
    -1
      src/DB.hs
  4. +1
    -1
      src/Sephibot.hs
  5. +1
    -1
      src/When.hs

+ 9
- 6
app/Main.hs View File

@@ -11,22 +11,25 @@ module Main where
import Relude
import Options.Generic
import qualified Data.Text as T
import System.Directory

import MyBot
import Sephibot

main :: IO ()
main = do
config <- unwrapRecord "My Bot"
reportTime (unHelpful $ token config) (getDbPath config)
config <- unwrapRecord "Sephibot"
dbpath <- getDbPath config
reportTime (unHelpful $ token config) dbpath

data Config w = Config
{ token :: Text <?> "Bot token"
, dbpath :: Maybe FilePath <?> "DB path (default is ~/.local/share/sephibot)"
, dbpath :: Maybe FilePath <?> "DB path (default is ~/.local/share/sephibot/db.bin)"
}
deriving (Generic)

getDbPath :: Config w -> FilePath
getDbPath = fromMaybe "~/.local/share/sephibot" . unHelpful . dbpath
getDbPath :: Config w -> IO FilePath
getDbPath =
maybe (getHomeDirectory <&> (<> "/.local/share/sephibot/db.bin")) pure . unHelpful . dbpath

instance ParseRecord (Config Wrapped)
deriving instance Show (Config Unwrapped)


+ 5
- 7
package.yaml View File

@@ -1,6 +1,5 @@
name: mybot
name: sephibot
version: 0.1.0.0
github: "gilmi/mybot"
license: BSD3
author: "Gil Mizrahi"
maintainer: "gilmi@posteo.net"
@@ -16,7 +15,7 @@ extra-source-files:
# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/gilmi/mybot#readme>
description: Please see the README on GitLab at <https://gitlab.com/gilmi/sephibot#readme>

dependencies:
- base >= 4.7 && < 5
@@ -74,7 +73,7 @@ library:


executables:
mybot-exe:
sephibot-exe:
main: Main.hs
source-dirs: app
ghc-options:
@@ -83,9 +82,8 @@ executables:
- -rtsopts
- -with-rtsopts=-N
dependencies:
- mybot
- sephibot
- relude
- directory
- optparse-generic
- time
- attoparsec


+ 1
- 1
src/DB.hs View File

@@ -64,7 +64,7 @@ writeDB db mystate = do

modifyDB :: (DB -> DB) -> MyState -> STM ()
modifyDB f mystate = flip writeDB mystate . f =<< readDB mystate
readDBIO :: MonadIO m => MyState -> m DB
readDBIO = atomically . readDB



src/MyBot.hs → src/Sephibot.hs View File

@@ -1,4 +1,4 @@
module MyBot where
module Sephibot where

import Relude hiding (toLower, isPrefixOf)
import Relude.Unsafe as U (read, init, last)

+ 1
- 1
src/When.hs View File

@@ -37,7 +37,7 @@ formatEnglish =
mergeEnglish :: [Text] -> Text
mergeEnglish = \case
[] -> "Yalla let's play!"
[unit] -> unit
[unit] -> unit <+> ". But who's counting?"
units -> T.intercalate ", " (U.init units) <+> "and" <+> (U.last units) <+> ". But who's counting?"

runWhenHebrew :: MonadIO m => UTCTime -> m Text


Loading…
Cancel
Save