floatlim.txt

来自「在上载一个bot源码给喜欢研究僵尸网络的朋友」· 文本 代码 · 共 70 行

TXT
70
字号
;@@@
;@@@ DreamBot IRC Bot 5.1
;@@@ File description: floatlim module (mode +l)
;@@@ Design & coding: Madar Petru
;@@@ (C) Copyright 2004-2005 by Madar Petru. All rights reserved. 
;@@@

on 400:text:*float*:#: {
  if ($1 == %c $+ global_float) {
    if ($level($address($nick,2)) == 500) {
      if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ global_float <on|off>. | halt }
      if ($2 !== $null) {
        if ($2 == on) { writeini -n ini\globals.ini Features FloatLim On | .enable #floatlim | .msg $nick The global floatlim is now enabled. | halt }
        if ($2 == off) { writeini -n ini\globals.ini Features FloatLim Off | .disable #floatlim | .msg $nick The global floatlim is now disabled. | .timerFl* off | halt }
        else { .msg $nick >>> Error: Invalid parameters. Available options: OP/OFF. | halt }
      }
    }
  }
  if ($1 == %c $+ channel_float) {
    if (($readini(ini\globals.ini, Features, FloatLim) == Off) || ($readini(ini\globals.ini, Features, Floatlim) == $null)) { .msg $nick The global floatlim is not enabled. To enable it, you must be a bot owner and type %c $+ global_float on or /msg $me global_float on. | halt }
    if ($2 == $null) { .msg $nick Command incomplete. Syntax: %c $+ channel_float <on|off> | halt }
    if ($2 !== $null) {
      if ($2 == on) { writeini -n ini\channels.ini $chan FloatLim On  | .msg $nick FloatLim for $chan now set to on. | _float $chan | halt }
      if ($2 == off) { writeini -n ini\channels.ini $chan FloatLim Off | .msg $nick FloatLim for $chan is now off. | _dfloat $chan | halt }
      else { .msg $nick >>> Error: Invalid parameters. Available options: ON/OFF. }
    }
  }
}
on 400:text:channel_float:?: {
  if (($readini(ini\globals.ini, Features, FloatLim) == Off) || ($readini(ini\globals.ini, Features, Floatlim) == $null)) { .msg $nick The global floatlim is not enabled. To enable it, you must be a bot owner and type %c $+ global_float on or /msg $me global_float on. | halt }
  if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me channel_float <#channel> <on|off> | halt }
  if (($2 !== $null) && ($3 !== $null)) {
    if ($3 == on) { writeini -n ini\channels.ini $2 FloatLim On | .msg $nick FloatLim for $2 now set to on. | _float $chan | halt }
    if ($3 == off) { writeini -n ini\channels.ini $2 FloatLim Off | .msg $nick FloatLim for $2 is now off. | _dloat $chan | halt }
    else { .msg $nick >>> Error: Invalid parameters. Available options: ON/OFF. }
  }
}
on 500:text:global_float*:?: {
  if ($2 == $null) { .msg $nick Command incomplete. Syntax: /msg $me global_float <on|off>. | halt }
  if ($2 !== $null) {
    if ($2 == on) { writeini -n ini\globals.ini Features FloatLim On | .enable #floatlim | .msg $nick The global floatlim is now enabled. | halt }
    if ($2 == off) { writeini -n ini\globals.ini Features FloatLim Off | .disable #floatlim | .msg $nick The global floatlim is now disabled. | halt }
    else { .msg $nick >>> Error: Invalid parameters. Available options: OP/OFF. | halt }
  }
}
#floatlim on
alias _float {
  .timer.float. $+ $1 0 %period.float _check.float $1
}
alias _dfloat {
  if ($me ison $1) {
    .timer.float. $+ $1 off
    ; if ($me isop $1) {
    ;   if (l isin $chan($1).mode) { .mode $1 -l }
    ; }
  }
}
alias _check.float {
  if (($readini(ini\globals.ini, Features, FloatLim) == Off) || ($readini(ini\globals.ini, Features, Floatlim) == $null) || ($readini(ini\channels.ini, $1, Floatlim) == Off) || ($readini(ini\channels.ini, $1, Floatlim) == $null)) { 
    ws $1 FloatLim Off
    _dfloat $1
    halt
  }
  if ($me !isop $1) { halt }
  if ($chan($1).limit == $null) { .mode $1 +l $calc($nick($1,0) + %margin.float) | halt }
  if ($chan($1).limit > %max.float) { halt }
  if (($calc($chan($1).limit - $nick($1,0)) <= %grace.float) || ($calc($chan($1).limit - $nick($1,0)) > %margin.float)) { mode $1 +l $calc($nick($1,0) + %margin.float) }
}
#floatlim end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?