~williewillus/r16

22c0e272393a3aaf414e747ece1e0d2b806c8573 — Vincent Lee 4 months ago 42a7870
Reorganize discord imports, update readme
2 files changed, 29 insertions(+), 14 deletions(-)

M README.md
M frontends/discord.rkt
M README.md => README.md +6 -2
@@ 1,6 1,9 @@
# r16

R16 is a "trick bot" for Discord. It saves snippets of code, which can then be recalled and executed on user-provided input.
R16 is a bot for interactive, community-driven code evaluation.
It saves snippets of code, which can then be recalled and executed on user-provided input.

Please see the [documentation](https://docs.racket-lang.org/r16/index.html) for details.

## History



@@ 20,7 23,8 @@ number to "16".
## Usage
1. Clone this repository
2. `raco pkg install --user --auto --type dir <clone directory>`
3. `BOT_TOKEN=<your discord token> racket main.rkt <directory to save in>`
3. Initialize a config file (see the docs)
4. `racket <clone_dir>/main.rkt -c config.json`

Alternatively, you can `raco pkg install r16` and run the bot from the install directory, using `raco pkg update` to update.


M frontends/discord.rkt => frontends/discord.rkt +23 -12
@@ 1,14 1,25 @@
#lang racket

(require "../interface.rkt"
         "../log.rkt"
         "../common.rkt"
         "../config.rkt"
         (prefix-in rc: racket-cord)
         (prefix-in http: racket-cord/http)
         (prefix-in ev: "../evaluator.rkt")
         (only-in net/url get-pure-port string->url)
         threading)
#lang racket/base

(require
 (only-in net/url get-pure-port string->url)
 racket/class
 racket/contract
 (only-in racket/format ~a)
 (only-in racket/function const curry identity negate thunk)
 racket/list
 racket/match
 (only-in racket/math exact-ceiling)
 (only-in racket/port port->bytes with-input-from-string with-output-to-string)
 racket/set
 racket/string
 threading
 (prefix-in http: racket-cord/http)
 (prefix-in rc: racket-cord)
 "../common.rkt"
 "../config.rkt"
 (prefix-in ev: "../evaluator.rkt")
 "../interface.rkt"
 "../log.rkt")

(provide r16-make-frontend)



@@ 362,7 373,7 @@
                inexact->exact (max 1) (min pages) sub1))
          (define page (drop tricks (* leaderboard-size pageno)))
          (list
           (if (empty? tricks)
           (if (null? tricks)
               (~a "There aren't any tricks registered in your guild! \
                    Use `" bot-prefix "register` to create one.")
               (apply