Skip to content

Instantly share code, notes, and snippets.

@erkin
Last active July 22, 2020 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erkin/8281e8e0c4d960b108ef682a2b4f2d95 to your computer and use it in GitHub Desktop.
Save erkin/8281e8e0c4d960b108ef682a2b4f2d95 to your computer and use it in GitHub Desktop.
Minimal Discord webhook client (text-only)
#lang racket/base
(require net/http-client json)
(define webhook-id "foo")
(define webhook-token "bar")
(module+ main
(http-conn-send!
(http-conn-open "discord.com" #:ssl? #t)
(string-append "/api/webhooks/" webhook-id "/" webhook-token)
#:method #"POST"
#:headers '("Content-Type: application/json")
#:data (jsexpr->string (hasheq 'content (read-string 2000)))
#:close? #t))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment