Decorators Message Context?
The decorators don't really say, can I use them on top of an interaction? If not, what's the recommended flow to use the decorators e.g.
RequiresGuildContext()
on things like a command rather than a subcommand?45 Replies
also is there any advantage to using shapeshift over zod?
e.g.
RequiresGuildContext requires the decorated method's first parameter to be a Message. Note to self add support for Interaction class. Anyway that's your answer.
copy that, okay, so
And subcommands can have preconditions including runIn to limit it to a guild
if I make the first parameter the message of the interaction, does that count or no?
yeah I figured out the subcommands part, but I saw the requirement for message -- just wondering if I can finagle it
cause the types for
user.permissions
is weird
string | ReadOnly<PermissionsBitField>
No. In JavaScript arguments are as provided when the method is called. You can't just type an arg as something else and it magically works.
no I meant, if I changed my
updateSettingsEmbed
to
private async updateSettingsEmbed(message: Message, interaction: Command.ChatInputCommandInteraction) {
Oh yeah you could but I would recommend making a PR to support interactions instead
copy that, will do now
Much better and helps everyone and saves me work too :kekw:
I just forgot to add it ages ago
And kept forgetting
lol you know I love the package too much and will do it oh no
can you point me to the right dir
can find it, just lazy
meh one sec
GitHub
utilities/packages/decorators/src/djs-decorators.ts at main · sapph...
Common JavaScript utilities for Sapphire Projects. Contribute to sapphiredev/utilities development by creating an account on GitHub.
found it hehe
ty
probably 20 minutes or so
Tip: yarn install in the mono repo then yarn build because decorators depends on packages within the workspace
No rush
I know I'm all about dat efficiency
Out for dinner anyway so can't really release anyway
one quick question, you probably know this better than me
Same :dragonheart:
anything other than Chat.ChatInputCommandInteraction?
that I should extend it to cover
BaseInteraction from djs catches all
oh lit
thank you
The others extend that class
you prefer yarn over bun?
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
I think bun has potential (unlike deno :kekw: ) but it doesn't have an equivalent of publishing packages yet so it's irrelevant for libraries
yeah true, I mean it does drop-in-replace NodeJS and it's webserver is like
900 times faster
like if you're using Node WebSockets
you should switch
cause their websockets are like 98 times faster or some stupid number and native
I tried bun here but I was stuck on publishing https://github.com/favware/graphql-pokemon/tree/refactor/switch-to-bun
which part? workflow or docker?
Workflow
That project is fully automated
Releases are done from GH workflow
As well as docker image updates and updating the docker container on my vps
the automatic data update?
cause that's still running yarn in the errored command I see
Continuous deployment
Also yes I just found that out ffs
I made some typo somewhere in the script
Cry
hahahaha
all good man the amount of times my bugs are the dumbest thing
it looks like your script is stopping for some reason on Generate JavaScript Companion library
is there some error throwing? It looks like it's just skipping
It's been broken for a while because bulbapedia (the website I scrape) added cloudflare captcha for a while and even flaresolverr couldn't flawlessly get by it. Now they disabled the captcha again so the script finally got to the last few lines but now there's a bug in writing the output
hehehe I have a Browserless up that gets past all of that
Oh normally it's perfect https://github.com/FlareSolverr/FlareSolverr
But query it over a 1000 times in rapid succession....
GitHub
GitHub - FlareSolverr/FlareSolverr: Proxy server to bypass Cloudfla...
Proxy server to bypass Cloudflare protection. Contribute to FlareSolverr/FlareSolverr development by creating an account on GitHub.
Lol they just released Pingora, their rust based API framework, maybe with that knowledge you can make it even better
I just use a Playwright browser
found this today though https://github.com/Skyvern-AI/skyvern
GitHub
GitHub - Skyvern-AI/skyvern: Automate browser-based workflows with ...
Automate browser-based workflows with LLMs and Computer Vision - Skyvern-AI/skyvern
Idk. Maybe if I run into the issue again but I hope they'll keep captcha off now
It was because they noticed an increased network activity over November December relates to DDOS
Who would want to DDOS bulbapedia
Despots is2g
this look good?
Can you dump it on https://hastebin.skyra.pw instead? I'm on mobile so that's a bit hard to read (no syntax highlighting, wrapping)
just swapped the message for context and checked the class instnace
yeh
https://hastebin.skyra.pw/okuzipojib.ts
that's just client perms just as an example of what i had in mind
Deduplicate it, no instanceof check like that.
okaydokey
fixed
not gonna use that check lol, but
that's the format
https://hastebin.skyra.pw/zanagaviyi.ts
I'll run tests and pull
GitHub
feat: add-interaction-support-to-decorators by ZachHandley · Pull R...
title, not like I saved the world here no need to explain more