• Guides
  • Api Documentation
Show / Hide Table of Contents
  • Discord.Addons.MpGame
    • CurrentlyPlaying
    • GameBase<TPlayer>
    • IMpGameData
    • MpGameModuleBase<TService, TGame, TPlayer>
    • MpGameService<TGame, TPlayer>
    • MpGameService<TGame, TPlayer>.MpGameData
    • Player
  • Discord.Addons.MpGame.Collections
    • CircularLinkedList<T>
    • Hand<T>
    • IWrapper<T>
    • Node<T>
    • Pile<T>
    • WrappingPile<T, TWrapper>
  • Discord.Addons.Preconditions
    • Measure
    • MinimumOnlineUsersAttribute
    • RatelimitAttribute
    • RatelimitFlags
    • RequireLowerHierarchyAttribute
    • RequireRoleAttribute
    • UserMustBeInVoiceAttribute

Class RatelimitAttribute

Sets how often a user is allowed to use this command or any command in this module.

Inheritance
Object
Attribute
PreconditionAttribute
RatelimitAttribute
Inherited Members
PreconditionAttribute.Group
Namespace: Discord.Addons.Preconditions
Assembly: Discord.Addons.Preconditions.dll
Syntax
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class RatelimitAttribute : PreconditionAttribute
Remarks
warning

This is backed by an in-memory collection and will not persist with restarts.

Constructors

| Improve this Doc View Source

RatelimitAttribute(UInt32, Double, Measure, RatelimitFlags)

Sets how often a user is allowed to use this command.

Declaration
public RatelimitAttribute(uint times, double period, Measure measure, RatelimitFlags flags = RatelimitFlags.None)
Parameters
Type Name Description
UInt32 times

The number of times a user may use the command within a certain period.

Double period

The amount of time since first invoke a user has until the limit is lifted.

Measure measure

The scale in which the period parameter should be measured.

RatelimitFlags flags

Flags to set behavior of the ratelimit.

| Improve this Doc View Source

RatelimitAttribute(UInt32, TimeSpan, RatelimitFlags)

Sets how often a user is allowed to use this command.

Declaration
public RatelimitAttribute(uint times, TimeSpan period, RatelimitFlags flags = RatelimitFlags.None)
Parameters
Type Name Description
UInt32 times

The number of times a user may use the command within a certain period.

TimeSpan period

The amount of time since first invoke a user has until the limit is lifted.

RatelimitFlags flags

Flags to set bahavior of the ratelimit.

Remarks
warning

This is a convinience constructor overload for use with the dynamic command builders, but not with the Class & Method-style commands.

Properties

| Improve this Doc View Source

ErrorMessage

Declaration
public override string ErrorMessage { get; set; }
Property Value
Type Description
String
Overrides
PreconditionAttribute.ErrorMessage

Methods

| Improve this Doc View Source

CheckPermissionsAsync(ICommandContext, CommandInfo, IServiceProvider)

Declaration
public override Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo _, IServiceProvider __)
Parameters
Type Name Description
ICommandContext context
CommandInfo _
IServiceProvider __
Returns
Type Description
Task<PreconditionResult>
Overrides
PreconditionAttribute.CheckPermissionsAsync(ICommandContext, CommandInfo, IServiceProvider)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX