Code Monkey home page Code Monkey logo

mirai-rate-limit's Introduction

Mirai-Rate-Limit

使用令牌桶实现消息发送限流

配置文件

# .\config\cn.ryoii.mirai-rate-limit\rate-limit.yml

# 全局限流
global:
  # 是否开启,默认开启
  enable: true
  # 限流行为:
  # drop: 丢弃, 停止本次消息发送
  # wait: 等待, 延时直到满足限流条件后发送
  behavior: drop
  # 暖机流量
  # 启动时可能会有大量消息发送,这里可以设置一个暖机流量,避免触发限流
  warmUp: 0
  # 流量突刺因子
  # 限流器会根据突刺因子计算出一个突刺流量,用于应对突发流量
  # 例如突刺因子为 0.5, TPS限制 100/min,则可应对最高 150/min 的突发流量
  burstFactor: 0.0
  # 流量限制为 limit/period
  # 例如 1 / 1s,即 TPS 为 1
  # 例如 1000 / 10s, 即 TPS 为 100
  limit: 1
  # 限流周期,格式参考 ISO-8601 Duration format
  # 或者如 17s,17m, 17h, 17d, 17m17s, 17d17h17m17s 的格式
  period: 1s

# Bot 限流
# bot: TODO

# 群聊限流
# group: TODO

# 私聊限流
# friend: TODO

TODO

  • 支持按 Bot, 群聊, 私聊分别限流
  • 提供 console 指令动态调整限流

mirai-rate-limit's People

Contributors

ryoii avatar smallcat9669 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.