GithubHelp home page GithubHelp logo

discord.hs's People

Contributors

cronokirby avatar fwrs avatar harmon758 avatar nagracks avatar taksuyu avatar tiltmesenpai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord.hs's Issues

Is this suitable for one-time fetches?

I want to write a one-time fetcher which runs gets of one's OAuth user and then quits. Is this library appropriate, or is it just bots?

If so, will I have to run a bot for a keepalive and then quit it with a close command, or can I just run a one-off command?

Ta!

Rewriting the library - A Fork

I’m working on a fork of this library called discord-haskell. I’ve changed the core of the library to use Chans instead of a monad transformer stack. Opening an issue is my best method of direct communication.

It’s in limbo between a fork and a entirely separate project. I’m using the types from discord-types and discord-rest and discord-gateway as starting points for my fork. I have rewritten discord-rest/Rest.hs and discord-gateway/Gateway.hs.

I started my own project instead of making pull requests because I reformatted all the code and then introduced massive breaking changes to the gateway and rest files. From the user perspective this is an entirely different library.

Feel free to open issues/pull requests on my fork with any suggestions.

BotDied

Hey,

I just deployed my bot using discord-hs and it seemed to work perfectly fine. However, after about 3 hours, the bot disconnected and kept spamming BotDied in console many times a second.
It took me quite a while to notice, so this inflated our log files quite a bit.

What exactly happened here and how can I prevent this? (Not just the log file inflation, but also to keep it online. After restarting, it seemed to reconnect just fine)

Add discord-hs to Stackage

The following steps need to be taken:

  • Relax build constraints so latest libraries can be used
  • Replace wreq (isn't in lts-8.2 build) OR PR wreq to enable it to be added to the lts-8.2 build
  • PR the stackage maintainers list to add me and d.hs to the build constraints file (Final step)

update build-depends

current build-depends:

  build-depends:       base==4.*
                     , aeson>=1.0 && <1.2
                     , bytestring==0.10.*
                     , case-insensitive==1.2.*
                     , comonad==5.*
                     , containers==0.5.*
                     , data-default==0.7.*
                     , hashable==1.2.*
                     , hslogger==1.2.*
                     , http-client==0.5.*
                     , mmorph==1.0.*
                     , mtl==2.2.*
                     , pipes==4.3.*
                     , stm-conduit==3.0.*
                     , stm==2.4.*
                     , text==1.2.*
                     , time>=1.6 && <1.9 
                     , transformers==0.5.*
                     , unordered-containers==0.2.*
                     , url==2.1.*
                     , vector>=0.10 && <0.13
                     , websockets==0.10.*
                     , req==0.2.*
                     , wuss==1.1.*

Could you update req==0.2.* to req==0.4.*?

Examples not using fetch'

The documentation of Network.Discord.Rest makes it seem like there is a much better way to make requests than just using fetch and fetch'. However, all examples currently use fetch'.

Could you make at least one example showing how to use Network.Discord.Rest.Channel and similar?

The documentation is also outdated by a couple versions.

README.md example doesn't work anymore.

Using this as compared to the example in the README.md file I still get some errors.

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}

import Data.Text
import Pipes

-- import Language.Discord -- Not included with the package anymore.
import Network.Discord

reply :: Message -> Text -> Effect DiscordM ()
reply Message{messageChannel=chan} cont = fetch' $ CreateMessage chan cont

main :: IO ()
main = runBot "TOKEN" $ do
  with ReadyEvent $ \(Init v u _ _ _) ->
    liftIO . putStrLn $ "Connected to gateway v" ++ show v ++ " as user " ++ show u

  with MessageCreateEvent $ \msg@Message{..} -> do
    when ("Ping" `isPrefixOf` messageContent && (not . userIsBot $ messageAuthor)) $
      reply msg "Pong!"

and the error

tak@moon ~/dev/projects/sodimm/dimmy % sb                                      :(
dimmy-0.1.0: build (exe)
Preprocessing executable 'dimmy' for dimmy-0.1.0...
[1 of 1] Compiling Main             ( Dimmy.lhs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/dimmy/dimmy-tmp/Main.o )

/home/tak/dev/projects/sodimm/dimmy/Dimmy.lhs:9:45: error:
    • No instance for (DoFetch (Maybe Embed -> ChannelRequest Message))
        arising from a use of ‘fetch'’
        (maybe you haven't applied a function to enough arguments?)
    • In the expression: fetch' $ CreateMessage chan cont
      In an equation for ‘reply’:
          reply (Message {messageChannel = chan}) cont
            = fetch' $ CreateMessage chan cont

/home/tak/dev/projects/sodimm/dimmy/Dimmy.lhs:12:17: error:
    • No instance for (Data.String.IsString Auth)
        arising from the literal ‘"TOKEN"’
    • In the first argument of ‘runBot’, namely ‘"TOKEN"’
      In the expression: runBot "TOKEN"
      In the expression:
        runBot "TOKEN"
        $ do { with ReadyEvent
               $ \ (Init v u _ _ _)
                   -> liftIO . putStrLn
                      $ "Connected to gateway v" ++ show v ++ " as user " ++ show u;
               with MessageCreateEvent $ \ msg@(Message {..}) -> do { ... } }

--  While building package dimmy-0.1.0 using:
      /home/tak/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build exe:dimmy --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

I'll play around with it and submit a PR if I figure it out, but it may just be a simple fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.