~williewillus/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH r16] Replace hardcoded admin check with administrator + manage guild

Details
Message ID
<20210227185414.1259617-1-vincent@vincent-lee.net>
DKIM signature
pass
Download raw message
Patch: +11 -9
---
Reply with ok/lgtm and I'll apply :wacko:

 r16.rkt | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/r16.rkt b/r16.rkt
index 97a4910..bc6e918 100755
--- a/r16.rkt
+++ b/r16.rkt
@@ -7,10 +7,8 @@
  (prefix-in db: "trick-db.rkt")

  (only-in racket/serialize serializable-struct/versions)
  (only-in "evaluator.rkt" (run ev:run)))

; williewillus#8490, maintainer, & Vazkii#0999, whose server we hope to run this in
(define bot-admins '("132691314784337920" "156785583723642881"))
  (only-in "evaluator.rkt" (run ev:run))
  threading)

(define prefix "!rkt ")
(define trick-prefix "!!")
@@ -44,13 +42,17 @@
    #f]))

(define (can-modify? message trick)
  (let ([author-id (message-author-id message)])
  (let ([author-id (message-author-id message)]
        [perms (bitwise-ior rc:permission-administrator
                            rc:permission-manage-guild)])
    (or
      (equal? (trick-author trick) author-id)
      ; TODO: Put a check here for Administrator/Manage Members:
      ; Use HTTP to turn message to channel to guild obj, search author ID to get member
      ; Then iter owned roles and lookup in guild to bit-check perms
      (member author-id bot-admins))))
      (let ([memb (rc:message-member message)])
        (and~> memb
               rc:guild-member-permissions
               string->number
               (bitwise-and perms)
               ((compose1 not zero?)))))))

(define (strip-backticks code)
  (let ([groups (regexp-match #px"```(\\w+\n)?(.+)```" code)])
-- 
2.30.1

[r16/patches/linux_buildtest.yml] build success

builds.sr.ht
Details
Message ID
<C9KJJ36TR4DX.2LHMX4VA1UUKS@cirno2>
In-Reply-To
<20210227185414.1259617-1-vincent@vincent-lee.net> (view parent)
DKIM signature
missing
Download raw message
r16/patches/linux_buildtest.yml: SUCCESS in 1m46s

[Replace hardcoded admin check with administrator + manage guild][0] from [Vincent Lee][1]

[0]: https://lists.sr.ht/~williewillus/public-inbox/patches/20655
[1]: mailto:vincent@vincent-lee.net

✓ #442472 SUCCESS r16/patches/linux_buildtest.yml https://builds.sr.ht/~williewillus/job/442472
Reply to thread Export thread (mbox)