Comments (7)
What is this check API? Is it similar to middlewares for individual commands?
from arikawa.
Check is basically individual command middleware yes. This will be run before command execution and check must return boolean. true
means the command will be executed, false
means that no permissions and command will be not executed.
from arikawa.
Check feels very niche. Is there a reason why you're not doing it for only one command?
The router already has middleware support for the entire subcommand, if you want to use one middleware for multiple commands.
from arikawa.
@diamondburned I think this should be useful for cooldowns, and however, current most used libraries provide ways to make check, so I think this should be useful in here too. Like there is a group of commands, but one command of these is for only for VIP users, so you have to make a request to DB and fetch info about user, and this should not apply to every command in a group.
from arikawa.
I'm saying to just append the check at the start of the function. Other libraries don't take an approach like this, so doing such a feature is as easy as another condition check. This library is reflect-based, meaning it's already complex as it is.
I do plan on implementing command aliases soon, but I'll leave this issue open for aliases. PRs welcomed.
from arikawa.
Custom checks or middlewares to be implemented in #24, funnily enough.
I'll do aliases later, I suppose.
from arikawa.
Aliases are done in #107
from arikawa.
Related Issues (20)
- `gateway.Gateway.Latency()` appears to be broken HOT 1
- voice: Upstream breaking changes
- v3: cmdroute: Add Router.Group() HOT 2
- SelectComponent should be StringSelectComponent? HOT 1
- Description for StringSelectComponent is incorrect
- Could not find Message Content Intent HOT 1
- v3: Fix regression from c07f574
- Discord doesn't display command results SOLVED HOT 1
- Default avatar is calculated incorrectly for migrated accounts
- v4: Generate API and Gateway structures
- v4: Automatically emit Gateway commands for State wrappers
- v4: Return api.InteractionResponse for CommandHandler
- v4: ComponentHandler should allow type-constructing handlers
- Unable to instrument API call HOT 10
- Support for api/v9/guilds/<guildid>/members/supplemental
- feat: Spacebar support
- v3: Inconsistent channel permission values for large guilds between sessions HOT 9
- v3: Add cmdroute.Router.Group
- v3: CommandInteraction Doesn't Support Attachment Options
- Groups do not use autocompleter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arikawa.