GithubHelp home page GithubHelp logo

notaurieh / discord.hs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tiltmesenpai/discord.hs

1.0 1.0 1.0 287 KB

Have you heard of our lord and savior Haskell?

License: MIT License

Haskell 100.00%

discord.hs's Introduction

Discord.hs

A Haskell wrapper for the Discord API

Hackage Hackage-Deps Travis

Using in a project

The preferred (and only supported) method of using discord.hs is through stack. Open your stack.yaml and find the extra-deps section. Add the following:

extra-deps:
  - discord-hs-0.2.1

Then open your project.cabal file and add discord-hs to your build-depends.

Alternatively, you can add discord-hs to your project.cabal file, and run stack solver --update-config. This will let stack catch other missing dependencies in your project and is most likely the better option.

PingPong

{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
import Data.Text
import Pipes

import Network.Discord

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

main :: IO ()
main = runBot (Bot "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!"

Known issues:

  • Init isn't parsing correctly
  • Client doesn't close correctly
  • Missing voice support

Future goals:

  • Eta compatibility
  • HaLVM compatibility (maybe)
  • Command framework (Posibly through compat layer with marvin?)
  • Ditch wreq (not included in stack lts-8.2)
  • Upload to stackage

discord.hs's People

Contributors

tiltmesenpai avatar aurieh avatar harmon758 avatar mutantmell avatar taksuyu avatar fwrs avatar cronokirby avatar nagracks avatar

Stargazers

Jack Dorland avatar

Watchers

James Cloos avatar

Forkers

mutantmell

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.