https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • a

    AlesVaupotic

    01/14/2021, 7:45 PM
    Ah, I see. Thanks!
  • a

    advaith

    01/14/2021, 8:07 PM
    is there any open-source Discord slash command bot code with Workers?
  • a

    advaith

    01/14/2021, 8:07 PM
    ik people have gotten it working by copy-pasting tweetnacl's code into the web editor but theres probably a better way
  • a

    advaith

    01/14/2021, 8:07 PM
    i havent used wrangler
  • j

    joe

    01/14/2021, 8:10 PM
    I was looking for a similar thing the other day, https://github.com/A5rocks/slash-worker seems to have a good base but I've not tested it
  • a

    advaith

    01/14/2021, 8:17 PM
    hm
  • a

    advaith

    01/14/2021, 8:17 PM
    it uses https://www.npmjs.com/package/@stablelib/ed25519 whatever that is
  • g

    Greg Brimble | Cloudflare Pages

    01/14/2021, 8:18 PM
    kv-asset-handler
    should pull
    mime@2.4.7
    when installing because of the
    ^2.4.6
    . (I've just tested with a fresh install, and it certainly looks to have). @User , if you re-install your dependencies (any maybe wipe
    package-lock.json
    ) and then redeploy, does that work?
  • j

    joe

    01/14/2021, 8:19 PM
    https://www.stablelib.com/modules/_ed25519_ed25519_.html
  • j

    joe

    01/14/2021, 8:19 PM
    stablelib is like
  • j

    joe

    01/14/2021, 8:19 PM
    extra stdlib
  • a

    advaith

    01/14/2021, 8:20 PM
    hm
  • t

    TiltMeSenpai

    01/14/2021, 8:41 PM
    I'm using a WebASM shim, results in way better CPU times https://github.com/TiltMeSenpai/cloudflare-bot
  • a

    advaith

    01/14/2021, 10:05 PM
    it would be great if Ed25519 was supported by the native crypto api
  • a

    advaith

    01/14/2021, 10:06 PM
    https://community.cloudflare.com/t/webcrypto-support-for-ed25519/228897
  • a

    advaith

    01/14/2021, 10:06 PM
    i assume "some services" there refers to discord lol
  • e

    Electroid

    01/14/2021, 10:10 PM
    Do you need ED25519 to use the Discord API?
  • p

    Peps

    01/14/2021, 10:11 PM
    https://discord.com/developers/docs/interactions/slash-commands#security-and-authorization
  • p

    Peps

    01/14/2021, 10:11 PM
    It's needed for Discord's new slash commands system
  • a

    advaith

    01/14/2021, 10:14 PM
    well
  • a

    advaith

    01/14/2021, 10:14 PM
    traditionally, bots only receive events via the websocket gateway
  • a

    advaith

    01/14/2021, 10:15 PM
    with the new slash commands and interactions, they can be received via gateway or http
  • a

    advaith

    01/14/2021, 10:15 PM
    but for http you need to use ed25519 to verify the request as the docs peps linked describe
  • k

    kristian

    01/14/2021, 10:16 PM
    https://github.com/cisco/node-jose has been a good auth lib for workers in the past
  • k

    kristian

    01/14/2021, 10:16 PM
    we have webcrypto built-in but (personal opinion incoming) i find it hard to use
  • k

    kristian

    01/14/2021, 10:17 PM
    sorry auth isn't even the right term, verification let's say
  • w

    Walshy | Pages

    01/14/2021, 10:17 PM
    You can use tweetnacl just like the Developer Docs suggest and then use Webpack to compile I made a repo a little bit ago for running slash commands on CF Workers:
  • e

    Electroid

    01/14/2021, 10:18 PM
    very cool! Does it eat the execution time limit though?
  • g

    Greg Brimble | Cloudflare Pages

    01/14/2021, 10:18 PM
    https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API Big bad warning telling you that Web Crypto is a difficult API. I think it's more than fair to find it tricky!
  • a

    advaith

    01/14/2021, 10:20 PM
    might be able to just use https://github.com/discord/discord-interactions-js
1...474849...2509Latest