Comments (7)
How would you know who the owner is?
from arikawa.
@diamondburned You can get it from application information. This should handle teams too.
from arikawa.
That's too niche. Having multiple arguments for one specific thing in the router wouldn't work.
Ideally, you'd either get it from the API or the application implements it by itself.
from arikawa.
Or maybe add Owner IDs defining?
from arikawa.
That won't do, as I said above.
from arikawa.
I have an idea.
from arikawa.
Once #24 gets implemented, you should be able to do the following:
const OwnerID = 694201337123123
func (cmds *Commands) Setup(sub *bot.Subcommand) {
// Add a middleware for all methods (*). The intake argument could also be
// an interface{}.
sub.AddMiddleware("*", func(c *gateway.MessageCreateEvent) error {
if c.Author.ID != OwnerID {
return bot.Break // silently break the chain
}
return nil // continue the chain
})
}
from arikawa.
Related Issues (20)
- v4: Support for context-based structured logging HOT 1
- `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
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.