zobweyt
Explore posts from serversAttributes confusion
also, all of these attributes will always be executed before processing the request until there is a negative result or all attributes check the conditions (this is because of the framework's nature for which I am trying to implement it). because of this, there may be conflicts: for example, I have this method:
although
AdminPolicy
skips all requests, the following attribute is always executed after it, which will be valid for all requests21 replies
Attributes confusion
speaking globally, what would you prefer as a user of it? pass policies into one attribute as the argument, thereby making the string infinitely long and unreadable, or make several such attributes that accept the policy as a generic argument creating a long chain of attributes on several lines?
21 replies
Attributes confusion
these are user defined (not constants)
as for the list of types, how do you type them correctly? for example, just
Type[] policies
? but how do you get the needed method to execute without hard-coding its name in a string? I was trying to find something like "generic type" so I could use it like that: Type<BaseType>[] policies
21 replies
Implementing rate limiting for discord bot interactions with absolute expiration of items
Implementations from other people:
- https://gist.github.com/PassiveModding/91b5756c1ba5f060fbc71f51e57a42f7
- https://github.com/jalaljaleh/Template.Discord.Bot/blob/7e22f9765c62d6b1f0928e85833a43db62e3a822/Template/Interactions/Precondinations/RateLimit.cs
- https://github.com/SylveonDeko/BoostBotV2/blob/d7d52de7a55dc4ddac792951b6df319bc34337d8/BoostBotV2/Common/Attributes/Interactions/Ratelimit.cs
- https://github.com/zobweyt/Discord.Net.Template/blob/1aa377e85b18bd1ae456f54677fd2b7caa895123/Template/Common/Preconditions/RateLimitAttribute.cs
5 replies