packages feed

calamity 0.1.16.0 → 0.1.17.0

raw patch · 17 files changed

+79/−53 lines, 17 filesdep +mime-typesdep +wreqdep −wreq-patchablePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: mime-types, wreq

Dependencies removed: wreq-patchable

API changes (from Hackage documentation)

- Calamity.Types.Tellable: newtype TFile
+ Calamity.Client.Types: [$sel:session:Client] :: Client -> Session
+ Calamity.Types.Tellable: data TFile
- Calamity.Cache.Eff: delDM :: forall r_a9zMO. MemberWithError CacheEff r_a9zMO => Snowflake DMChannel -> Sem r_a9zMO ()
+ Calamity.Cache.Eff: delDM :: forall r_a9zRA. MemberWithError CacheEff r_a9zRA => Snowflake DMChannel -> Sem r_a9zRA ()
- Calamity.Cache.Eff: delGuild :: forall r_a9zMH. MemberWithError CacheEff r_a9zMH => Snowflake Guild -> Sem r_a9zMH ()
+ Calamity.Cache.Eff: delGuild :: forall r_a9zRt. MemberWithError CacheEff r_a9zRt => Snowflake Guild -> Sem r_a9zRt ()
- Calamity.Cache.Eff: delMessage :: forall r_a9zN9. MemberWithError CacheEff r_a9zN9 => Snowflake Message -> Sem r_a9zN9 ()
+ Calamity.Cache.Eff: delMessage :: forall r_a9zRV. MemberWithError CacheEff r_a9zRV => Snowflake Message -> Sem r_a9zRV ()
- Calamity.Cache.Eff: delUnavailableGuild :: forall r_a9zN2. MemberWithError CacheEff r_a9zN2 => Snowflake Guild -> Sem r_a9zN2 ()
+ Calamity.Cache.Eff: delUnavailableGuild :: forall r_a9zRO. MemberWithError CacheEff r_a9zRO => Snowflake Guild -> Sem r_a9zRO ()
- Calamity.Cache.Eff: delUser :: forall r_a9zMV. MemberWithError CacheEff r_a9zMV => Snowflake User -> Sem r_a9zMV ()
+ Calamity.Cache.Eff: delUser :: forall r_a9zRH. MemberWithError CacheEff r_a9zRH => Snowflake User -> Sem r_a9zRH ()
- Calamity.Cache.Eff: getBotUser :: forall r_a9zMz. MemberWithError CacheEff r_a9zMz => Sem r_a9zMz (Maybe User)
+ Calamity.Cache.Eff: getBotUser :: forall r_a9zRl. MemberWithError CacheEff r_a9zRl => Sem r_a9zRl (Maybe User)
- Calamity.Cache.Eff: getDM :: forall r_a9zML. MemberWithError CacheEff r_a9zML => Snowflake DMChannel -> Sem r_a9zML (Maybe DMChannel)
+ Calamity.Cache.Eff: getDM :: forall r_a9zRx. MemberWithError CacheEff r_a9zRx => Snowflake DMChannel -> Sem r_a9zRx (Maybe DMChannel)
- Calamity.Cache.Eff: getDMs :: forall r_a9zMN. MemberWithError CacheEff r_a9zMN => Sem r_a9zMN [DMChannel]
+ Calamity.Cache.Eff: getDMs :: forall r_a9zRz. MemberWithError CacheEff r_a9zRz => Sem r_a9zRz [DMChannel]
- Calamity.Cache.Eff: getGuild :: forall r_a9zMC. MemberWithError CacheEff r_a9zMC => Snowflake Guild -> Sem r_a9zMC (Maybe Guild)
+ Calamity.Cache.Eff: getGuild :: forall r_a9zRo. MemberWithError CacheEff r_a9zRo => Snowflake Guild -> Sem r_a9zRo (Maybe Guild)
- Calamity.Cache.Eff: getGuildChannel :: forall r_a9zME. MemberWithError CacheEff r_a9zME => Snowflake GuildChannel -> Sem r_a9zME (Maybe GuildChannel)
+ Calamity.Cache.Eff: getGuildChannel :: forall r_a9zRq. MemberWithError CacheEff r_a9zRq => Snowflake GuildChannel -> Sem r_a9zRq (Maybe GuildChannel)
- Calamity.Cache.Eff: getGuilds :: forall r_a9zMG. MemberWithError CacheEff r_a9zMG => Sem r_a9zMG [Guild]
+ Calamity.Cache.Eff: getGuilds :: forall r_a9zRs. MemberWithError CacheEff r_a9zRs => Sem r_a9zRs [Guild]
- Calamity.Cache.Eff: getMessage :: forall r_a9zN6. MemberWithError CacheEff r_a9zN6 => Snowflake Message -> Sem r_a9zN6 (Maybe Message)
+ Calamity.Cache.Eff: getMessage :: forall r_a9zRS. MemberWithError CacheEff r_a9zRS => Snowflake Message -> Sem r_a9zRS (Maybe Message)
- Calamity.Cache.Eff: getMessages :: forall r_a9zN8. MemberWithError CacheEff r_a9zN8 => Sem r_a9zN8 [Message]
+ Calamity.Cache.Eff: getMessages :: forall r_a9zRU. MemberWithError CacheEff r_a9zRU => Sem r_a9zRU [Message]
- Calamity.Cache.Eff: getUnavailableGuilds :: forall r_a9zN1. MemberWithError CacheEff r_a9zN1 => Sem r_a9zN1 [Snowflake Guild]
+ Calamity.Cache.Eff: getUnavailableGuilds :: forall r_a9zRN. MemberWithError CacheEff r_a9zRN => Sem r_a9zRN [Snowflake Guild]
- Calamity.Cache.Eff: getUser :: forall r_a9zMS. MemberWithError CacheEff r_a9zMS => Snowflake User -> Sem r_a9zMS (Maybe User)
+ Calamity.Cache.Eff: getUser :: forall r_a9zRE. MemberWithError CacheEff r_a9zRE => Snowflake User -> Sem r_a9zRE (Maybe User)
- Calamity.Cache.Eff: getUsers :: forall r_a9zMU. MemberWithError CacheEff r_a9zMU => Sem r_a9zMU [User]
+ Calamity.Cache.Eff: getUsers :: forall r_a9zRG. MemberWithError CacheEff r_a9zRG => Sem r_a9zRG [User]
- Calamity.Cache.Eff: isUnavailableGuild :: forall r_a9zMZ. MemberWithError CacheEff r_a9zMZ => Snowflake Guild -> Sem r_a9zMZ Bool
+ Calamity.Cache.Eff: isUnavailableGuild :: forall r_a9zRL. MemberWithError CacheEff r_a9zRL => Snowflake Guild -> Sem r_a9zRL Bool
- Calamity.Cache.Eff: setBotUser :: forall r_a9zMx. MemberWithError CacheEff r_a9zMx => User -> Sem r_a9zMx ()
+ Calamity.Cache.Eff: setBotUser :: forall r_a9zRj. MemberWithError CacheEff r_a9zRj => User -> Sem r_a9zRj ()
- Calamity.Cache.Eff: setDM :: forall r_a9zMJ. MemberWithError CacheEff r_a9zMJ => DMChannel -> Sem r_a9zMJ ()
+ Calamity.Cache.Eff: setDM :: forall r_a9zRv. MemberWithError CacheEff r_a9zRv => DMChannel -> Sem r_a9zRv ()
- Calamity.Cache.Eff: setGuild :: forall r_a9zMA. MemberWithError CacheEff r_a9zMA => Guild -> Sem r_a9zMA ()
+ Calamity.Cache.Eff: setGuild :: forall r_a9zRm. MemberWithError CacheEff r_a9zRm => Guild -> Sem r_a9zRm ()
- Calamity.Cache.Eff: setMessage :: forall r_a9zN4. MemberWithError CacheEff r_a9zN4 => Message -> Sem r_a9zN4 ()
+ Calamity.Cache.Eff: setMessage :: forall r_a9zRQ. MemberWithError CacheEff r_a9zRQ => Message -> Sem r_a9zRQ ()
- Calamity.Cache.Eff: setUnavailableGuild :: forall r_a9zMX. MemberWithError CacheEff r_a9zMX => Snowflake Guild -> Sem r_a9zMX ()
+ Calamity.Cache.Eff: setUnavailableGuild :: forall r_a9zRJ. MemberWithError CacheEff r_a9zRJ => Snowflake Guild -> Sem r_a9zRJ ()
- Calamity.Cache.Eff: setUser :: forall r_a9zMQ. MemberWithError CacheEff r_a9zMQ => User -> Sem r_a9zMQ ()
+ Calamity.Cache.Eff: setUser :: forall r_a9zRC. MemberWithError CacheEff r_a9zRC => User -> Sem r_a9zRC ()
- Calamity.Client.Client: runBotIO' :: forall r a. (Members '[Embed IO, Final IO, CacheEff, MetricEff] r, Typeable (SetupEff r)) => Token -> Maybe StatusUpdateData -> Maybe Intents -> Sem (SetupEff r) a -> Sem r (Maybe StartupError)
+ Calamity.Client.Client: runBotIO' :: forall r a. (Members '[Embed IO, Final IO, CacheEff, MetricEff] r, Typeable (SetupEff r)) => Token -> Maybe Session -> Maybe StatusUpdateData -> Maybe Intents -> Sem (SetupEff r) a -> Sem r (Maybe StartupError)
- Calamity.Client.Types: Client :: TVar [(InChan ControlMessage, Async (Maybe ()))] -> MVar Int -> Token -> RateLimitState -> InChan CalamityEvent -> OutChan CalamityEvent -> IORef Integer -> Client
+ Calamity.Client.Types: Client :: TVar [(InChan ControlMessage, Async (Maybe ()))] -> MVar Int -> Token -> RateLimitState -> InChan CalamityEvent -> OutChan CalamityEvent -> IORef Integer -> Session -> Client
- Calamity.Commands.ParsePrefix: parsePrefix :: forall r_a7bMs. MemberWithError ParsePrefix r_a7bMs => Message -> Sem r_a7bMs (Maybe (Text, Text))
+ Calamity.Commands.ParsePrefix: parsePrefix :: forall r_a7bRf. MemberWithError ParsePrefix r_a7bRf => Message -> Sem r_a7bRf (Maybe (Text, Text))
- Calamity.HTTP.Channel: CreateMessageOptions :: Maybe Text -> Maybe Text -> Maybe Bool -> Maybe ByteString -> Maybe Embed -> Maybe AllowedMentions -> CreateMessageOptions
+ Calamity.HTTP.Channel: CreateMessageOptions :: Maybe Text -> Maybe Text -> Maybe Bool -> Maybe (Text, ByteString) -> Maybe Embed -> Maybe AllowedMentions -> CreateMessageOptions
- Calamity.HTTP.Channel: [$sel:file:CreateMessageOptions] :: CreateMessageOptions -> Maybe ByteString
+ Calamity.HTTP.Channel: [$sel:file:CreateMessageOptions] :: CreateMessageOptions -> Maybe (Text, ByteString)
- Calamity.HTTP.Internal.Request: action :: Request a => a -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: action :: Request a => a -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: getWithP :: (Options -> Options) -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: getWithP :: (Options -> Options) -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: patchWith' :: Patchable a => a -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: patchWith' :: Postable a => a -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: postEmpty :: Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: postEmpty :: Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: postEmptyP :: (Options -> Options) -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: postEmptyP :: (Options -> Options) -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: postWith' :: Postable a => a -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: postWith' :: Postable a => a -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: postWithP' :: Postable a => a -> (Options -> Options) -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: postWithP' :: Postable a => a -> (Options -> Options) -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: putEmpty :: Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: putEmpty :: Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: putEmptyP :: (Options -> Options) -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: putEmptyP :: (Options -> Options) -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.HTTP.Internal.Request: putWith' :: Putable a => a -> Options -> String -> IO (Response ByteString)
+ Calamity.HTTP.Internal.Request: putWith' :: Putable a => a -> Options -> Session -> String -> IO (Response ByteString)
- Calamity.Internal.LocalWriter: llisten :: forall o_aEFt r_aEVt a_XEFt. MemberWithError (LocalWriter o_aEFt) r_aEVt => Sem r_aEVt a_XEFt -> Sem r_aEVt (o_aEFt, a_XEFt)
+ Calamity.Internal.LocalWriter: llisten :: forall o_aEHK r_aEXK a_XEHK. MemberWithError (LocalWriter o_aEHK) r_aEXK => Sem r_aEXK a_XEHK -> Sem r_aEXK (o_aEHK, a_XEHK)
- Calamity.Internal.LocalWriter: ltell :: forall o_aEFp r_aEVr. MemberWithError (LocalWriter o_aEFp) r_aEVr => o_aEFp -> Sem r_aEVr ()
+ Calamity.Internal.LocalWriter: ltell :: forall o_aEHG r_aEXI. MemberWithError (LocalWriter o_aEHG) r_aEXI => o_aEHG -> Sem r_aEXI ()
- Calamity.Metrics.Eff: addCounter :: forall r_aIJ6. MemberWithError MetricEff r_aIJ6 => Int -> Counter -> Sem r_aIJ6 Int
+ Calamity.Metrics.Eff: addCounter :: forall r_aILn. MemberWithError MetricEff r_aILn => Int -> Counter -> Sem r_aILn Int
- Calamity.Metrics.Eff: modifyGauge :: forall r_aIJ9. MemberWithError MetricEff r_aIJ9 => (Double -> Double) -> Gauge -> Sem r_aIJ9 Double
+ Calamity.Metrics.Eff: modifyGauge :: forall r_aILq. MemberWithError MetricEff r_aILq => (Double -> Double) -> Gauge -> Sem r_aILq Double
- Calamity.Metrics.Eff: observeHistogram :: forall r_aIJc. MemberWithError MetricEff r_aIJc => Double -> Histogram -> Sem r_aIJc HistogramSample
+ Calamity.Metrics.Eff: observeHistogram :: forall r_aILt. MemberWithError MetricEff r_aILt => Double -> Histogram -> Sem r_aILt HistogramSample
- Calamity.Metrics.Eff: registerCounter :: forall r_aIIW. MemberWithError MetricEff r_aIIW => Text -> [(Text, Text)] -> Sem r_aIIW Counter
+ Calamity.Metrics.Eff: registerCounter :: forall r_aILd. MemberWithError MetricEff r_aILd => Text -> [(Text, Text)] -> Sem r_aILd Counter
- Calamity.Metrics.Eff: registerGauge :: forall r_aIIZ. MemberWithError MetricEff r_aIIZ => Text -> [(Text, Text)] -> Sem r_aIIZ Gauge
+ Calamity.Metrics.Eff: registerGauge :: forall r_aILg. MemberWithError MetricEff r_aILg => Text -> [(Text, Text)] -> Sem r_aILg Gauge
- Calamity.Metrics.Eff: registerHistogram :: forall r_aIJ2. MemberWithError MetricEff r_aIJ2 => Text -> [(Text, Text)] -> [Double] -> Sem r_aIJ2 Histogram
+ Calamity.Metrics.Eff: registerHistogram :: forall r_aILj. MemberWithError MetricEff r_aILj => Text -> [(Text, Text)] -> [Double] -> Sem r_aILj Histogram
- Calamity.Types.Tellable: TFile :: ByteString -> TFile
+ Calamity.Types.Tellable: TFile :: Text -> ByteString -> TFile

Files

ChangeLog.md view
@@ -1,5 +1,15 @@ # Changelog for Calamity +## 0.1.17.0++*2020-06-28*++* Allow the session used for http requests to be specified to the client.++* Drop from using a Wreq fork to vanilla Wreq.++* `TFile` now requires a filename parameter.+ ## 0.1.16.0  * Change how commands should be manually invoked from code, instead of firing a
calamity.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 7fb5885fd8780fbb721679f8e2823047e0bea244a686ec69115ca4b56159f700+-- hash: d52c65805c329ab185c6c81bf5373347ad1946bdeef8964dd4999f411797d6a2  name:           calamity-version:        0.1.16.0+version:        0.1.17.0 synopsis:       A library for writing discord bots in haskell description:    Please see the README on GitHub at <https://github.com/nitros12/calamity#readme> category:       Network, Web@@ -162,6 +162,7 @@     , lens >=4.18 && <5     , lens-aeson >=1.1 && <2     , megaparsec >=8 && <9+    , mime-types >=0.1 && <0.2     , mtl >=2.2 && <3     , polysemy >=1.3 && <2     , polysemy-plugin >=0.2 && <0.3@@ -179,6 +180,6 @@     , unordered-containers >=0.2 && <0.3     , vector >=0.12 && <0.13     , websockets >=0.12 && <0.13-    , wreq-patchable >=1.0 && <2+    , wreq >=0.5 && <0.6     , wuss >=1.1 && <2   default-language: Haskell2010
src/Calamity/Client/Client.hs view
@@ -55,6 +55,8 @@  import qualified DiPolysemy                        as Di +import           Network.Wreq.Session            ( Session, newAPISession )+ import           Fmt  import qualified Polysemy                          as P@@ -75,8 +77,8 @@   pure (duration, res)  -newClient :: Token -> IO Client-newClient token = do+newClient :: Token -> Session -> IO Client+newClient token session = do   shards'        <- newTVarIO []   numShards'     <- newEmptyMVar   rlState'       <- newRateLimitState@@ -90,6 +92,7 @@                 inc                 outc                 ehidCounter+                session  -- | Create a bot, run your setup action, and then loop until the bot closes. runBotIO :: forall r a.@@ -97,20 +100,22 @@          => Token          -> P.Sem (SetupEff r) a          -> P.Sem r (Maybe StartupError)-runBotIO token setup = runBotIO' token Nothing Nothing setup+runBotIO token setup = runBotIO' token Nothing Nothing Nothing setup  -- | Create a bot, run your setup action, and then loop until the bot closes. ----- This version allows you to specify the initial status and intents.+-- This version allows you to specify the session and initial status and intents. runBotIO' :: forall r a.           (P.Members '[P.Embed IO, P.Final IO, CacheEff, MetricEff] r, Typeable (SetupEff r))           => Token+          -> Maybe Session           -> Maybe StatusUpdateData           -> Maybe Intents           -> P.Sem (SetupEff r) a           -> P.Sem r (Maybe StartupError)-runBotIO' token status intents setup = do-  client <- P.embed $ newClient token+runBotIO' token session status intents setup = do+  session' <- maybe (P.embed newAPISession) pure session+  client <- P.embed $ newClient token session'   handlers <- P.embed $ newTVarIO def   P.asyncToIOFinal . P.runAtomicStateTVar handlers . P.runReader client . Di.runDiToStderrIOFinal . Di.push "calamity" $ do     void $ Di.push "calamity-setup" setup
src/Calamity/Client/Types.hs view
@@ -44,6 +44,8 @@ import           Data.Typeable import           Data.Void +import           Network.Wreq.Session            ( Session )+ import           GHC.Exts                        ( fromList ) import           GHC.Generics @@ -63,6 +65,7 @@   , eventsIn            :: InChan CalamityEvent   , eventsOut           :: OutChan CalamityEvent   , ehidCounter         :: IORef Integer+  , session             :: Session   }   deriving ( Generic ) 
src/Calamity/Commands.hs view
@@ -46,21 +46,13 @@ -- --         Fired when a command returns an error. -----     2. @"command-not-found" ('Calamity.Types.Model.Channel.Message', '['Data.Text.Lazy.Text'])@+--     2. @"command-not-found" ('Calamity.Types.Model.Channel.Message', ['Data.Text.Lazy.Text'])@ -- --         Fired when a valid prefix is used, but the command is not found. -- --     3. @"command-invoked" 'Context'@ -- --         Fired when a command is successfully invoked.------ 'addCommands' will also register event handlers for the following events:------     1. @"invoke-command" ('Calamity.Types.Model.Channel.Message', 'Data.Text.Lazy.Text')@------         Given a message and a command string, manually invoke a command---         treating it as if it originated from the provided 'Message'.--- -- -- ==== Registered Metrics --
src/Calamity/Commands/Utils.hs view
@@ -64,7 +64,7 @@ -- --         Fired when a command returns an error. -----     2. @"command-not-found" ('Calamity.Types.Model.Channel.Message', '['Data.Text.Lazy.Text'])@+--     2. @"command-not-found" ('Calamity.Types.Model.Channel.Message', ['Data.Text.Lazy.Text'])@ -- --         Fired when a valid prefix is used, but the command is not found. --
src/Calamity/HTTP/AuditLog.hs view
@@ -18,7 +18,7 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq.Lens  import           TextShow                       ( showt ) 
src/Calamity/HTTP/Channel.hs view
@@ -26,11 +26,15 @@ import           Data.Default.Class import           Data.Generics.Product.Subtype  ( upcast ) import           Data.Maybe+import qualified Data.Text                      as S import           Data.Text                      ( Text )  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq ( partLBS )+import           Network.Wreq.Lens+import           Network.Wreq.Session+import           Network.Mime  import           TextShow @@ -38,7 +42,7 @@   { content         :: Maybe Text   , nonce           :: Maybe Text   , tts             :: Maybe Bool-  , file            :: Maybe ByteString+  , file            :: Maybe (Text, ByteString)   , embed           :: Maybe Embed   , allowedMentions :: Maybe AllowedMentions   }@@ -240,7 +244,8 @@   action (CreateMessage _ o@CreateMessageOptions { file = Nothing }) = postWith'     (toJSON . upcast @CreateMessageJson $ o)   action (CreateMessage _ o@CreateMessageOptions { file = Just f }) = postWith'-    [partLBS @IO "file" f, partLBS "payload_json" (encode . upcast @CreateMessageJson $ o)]+    [partLBS @IO "file" (snd f) & partFileName ?~ (S.unpack $ fst f) & partContentType ?~ defaultMimeLookup (fst f),+     partLBS "payload_json" (encode . upcast @CreateMessageJson $ o)]   action (GetChannel _) = getWith   action (ModifyChannel _ p) = putWith' (toJSON p)   action (DeleteChannel _) = deleteWith
src/Calamity/HTTP/Emoji.hs view
@@ -17,7 +17,8 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq.Lens+import           Network.Wreq.Session   data CreateGuildEmojiOptions = CreateGuildEmojiOptions
src/Calamity/HTTP/Guild.hs view
@@ -34,7 +34,8 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq.Lens+import           Network.Wreq.Session  import           TextShow 
src/Calamity/HTTP/Internal/Request.hs view
@@ -30,8 +30,9 @@  import           DiPolysemy                       hiding ( debug, error, info ) -import           Network.Wreq-import           Network.Wreq.Types               ( Patchable, Postable, Putable )+import           Network.Wreq                     (Response, checkResponse, header, defaults)+import           Network.Wreq.Session+import           Network.Wreq.Types               (Options, Postable, Putable )  import           Polysemy                         ( Sem ) import qualified Polysemy                         as P@@ -64,12 +65,13 @@    route :: a -> Route -  action :: a -> Options -> String -> IO (Response LB.ByteString)+  action :: a -> Options -> Session -> String -> IO (Response LB.ByteString)    invoke :: (BotC r, FromJSON (Calamity.HTTP.Internal.Request.Result a)) => a -> Sem r (Either RestError (Calamity.HTTP.Internal.Request.Result a))   invoke a = do-      rlState' <- P.asks rlState-      token' <- P.asks token+      rlState' <- P.asks (^. #rlState)+      session <- P.asks (^. #session)+      token' <- P.asks (^. #token)        let route' = route a @@ -79,7 +81,7 @@       void $ addCounter 1 totalRequests        resp <- attr "route" (route' ^. #path) $ doRequest rlState' route'-        (action a (requestOptions token') (route' ^. #path . unpacked))+        (action a (requestOptions token') session (route' ^. #path . unpacked))        void $ modifyGauge (subtract 1) inFlightRequests @@ -95,29 +97,29 @@ requestOptions t = defaultRequestOptions   & header "Authorization" .~ [TS.encodeUtf8 . TL.toStrict $ formatToken t] -postWith' :: Postable a => a -> Options -> String -> IO (Response LB.ByteString)-postWith' p o s = postWith o s p+postWith' :: Postable a => a -> Options -> Session -> String -> IO (Response LB.ByteString)+postWith' p o sess s = postWith o sess s p -postWithP' :: Postable a => a -> (Options -> Options) -> Options -> String -> IO (Response LB.ByteString)-postWithP' p oF o s = postWith (oF o) s p+postWithP' :: Postable a => a -> (Options -> Options) -> Options -> Session -> String -> IO (Response LB.ByteString)+postWithP' p oF o sess s = postWith (oF o) sess s p -postEmpty :: Options -> String -> IO (Response LB.ByteString)-postEmpty o s = postWith o s ("" :: ByteString)+postEmpty :: Options -> Session -> String -> IO (Response LB.ByteString)+postEmpty o sess s = postWith o sess s ("" :: ByteString) -putWith' :: Putable a => a -> Options -> String -> IO (Response LB.ByteString)-putWith' p o s = putWith o s p+putWith' :: Putable a => a -> Options -> Session -> String -> IO (Response LB.ByteString)+putWith' p o sess s = putWith o sess s p -patchWith' :: Patchable a => a -> Options -> String -> IO (Response LB.ByteString)-patchWith' p o s = patchWith o s p+patchWith' :: Postable a => a -> Options -> Session -> String -> IO (Response LB.ByteString)+patchWith' p o sess s = customPayloadMethodWith "PATCH" o sess s p -putEmpty :: Options -> String -> IO (Response LB.ByteString)-putEmpty o s = putWith o s ("" :: ByteString)+putEmpty :: Options -> Session -> String -> IO (Response LB.ByteString)+putEmpty o sess s = putWith o sess s ("" :: ByteString) -putEmptyP :: (Options -> Options) -> Options -> String -> IO (Response LB.ByteString)+putEmptyP :: (Options -> Options) -> Options -> Session -> String -> IO (Response LB.ByteString) putEmptyP = (putEmpty .) -postEmptyP :: (Options -> Options) -> Options -> String -> IO (Response LB.ByteString)+postEmptyP :: (Options -> Options) -> Options -> Session -> String -> IO (Response LB.ByteString) postEmptyP = (postEmpty .) -getWithP :: (Options -> Options) -> Options -> String -> IO (Response LB.ByteString)+getWithP :: (Options -> Options) -> Options -> Session -> String -> IO (Response LB.ByteString) getWithP oF o = getWith (oF o)
src/Calamity/HTTP/Invite.hs view
@@ -10,7 +10,8 @@  import           Data.Text                      ( Text ) -import           Network.Wreq+import           Network.Wreq.Lens+import           Network.Wreq.Session  import           TextShow 
src/Calamity/HTTP/MiscRoutes.hs view
@@ -7,7 +7,7 @@  import           Data.Function -import           Network.Wreq+import           Network.Wreq.Session  data MiscRequest a where   GetGateway    :: MiscRequest GatewayResponse
src/Calamity/HTTP/Reason.hs view
@@ -12,7 +12,7 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq.Lens  data Reason a = Reason a Text   deriving ( Show, Eq, Generic )
src/Calamity/HTTP/User.hs view
@@ -22,7 +22,8 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq.Lens+import           Network.Wreq.Session  import           TextShow 
src/Calamity/HTTP/Webhook.hs view
@@ -23,7 +23,9 @@  import           GHC.Generics -import           Network.Wreq+import           Network.Wreq ( partLBS )+import           Network.Wreq.Lens+import           Network.Wreq.Session  import           TextShow 
src/Calamity/Types/Tellable.hs view
@@ -27,7 +27,9 @@ import qualified Polysemy.Error               as P  -- | A wrapper type for sending files-newtype TFile = TFile ByteString+data TFile = TFile+             S.Text -- ^ The filename+             ByteString -- ^ The content   deriving ( Show, Generic )  -- | A wrapper type for allowing mentions@@ -63,7 +65,7 @@  -- | Message file, '(<>)' keeps the last added file instance ToMessage TFile where-  intoMsg (TFile f) = Endo (#file %~ getLast . (<> Last (Just f)) . Last)+  intoMsg (TFile n f) = Endo (#file %~ getLast . (<> Last (Just (n, f))) . Last)  -- | Allowed mentions, '(<>)' combines allowed mentions instance ToMessage AllowedMentions where