Public paste
Undefined
By: Guest | Date: Nov 11 2022 19:20 | Format: None | Expires: never | Size: 8.58 KB | Hits: 241

  1. on *:TEXT:*:#: {
  2.   if ($1 == .admin) {
  3.     if ($owner($address($nick,1))) {
  4.       if (!$2) {
  5.         .notice $nick %ctstart ERROR! Usage: .admin add/del/list (parameter) %ctstop
  6.       }
  7.       elseif ($2 == add) {
  8.         if (!$3) {
  9.           .notice $nick %ctstart ERROR! Usage .admin add nick/host %ctstop
  10.         }
  11.         elseif ($3 ison $chan) {
  12.           if (!$admin($address($3,1))) {
  13.             write bot\admin.txt $address($3,1)
  14.             .notice $nick %ctstart $3 ( $+ $address($3,1) $+ ) was added as admin %ctstop
  15.           }
  16.           else {
  17.             .notice $nick %ctstart ERROR! $3 ( $+ $address($3,1) $+ ) is already added as admin %ctstop
  18.           }
  19.         }
  20.         else {
  21.           if (!$admin($3)) {
  22.             write bot\admin.txt $3
  23.             .notice $nick %ctstart NoNick ( $+ $3 $+ ) was added as admin %ctstop
  24.           }
  25.           else {
  26.             .notice $nick %ctstart ERROR! NoNick ( $+ $3 $+ ) is already added as admin %ctstop
  27.           }
  28.         }
  29.       }
  30.       elseif ($2 == del) {
  31.         if (!$3) {
  32.           .notice $nick %ctstart ERROR! Usage .admin del nick/host/all %ctstop
  33.         }
  34.         elseif ($3 == all) {
  35.           .remove bot\admin.txt
  36.           .notice $nick %ctstart All admins removed. %ctstop
  37.         }
  38.         elseif ($left($3,1) == $chr(35)) {
  39.           .notice $nick %ctstart NoName ( $+ $read(bot\admin.txt,$right($3,-1)) $+ ) was deleted as admin %ctstop
  40.           write -dl $+ $right($3,-1) bot\admin.txt
  41.         }
  42.         elseif ($3 ison $chan) {
  43.           if ($admin($address($3,1))) {
  44.             $read(bot\ban.txt,w,$address($3,1))
  45.             write -dl $+ $readn bot\admin.txt
  46.             .notice $nick %ctstart $3 ( $+ $address($3,1) $+ ) was deleted as admin %ctstop
  47.           }
  48.           else {
  49.             .notice $nick %ctstart ERROR! $3 ( $+ $address($3,1) $+ ) is not added as admin %ctstop
  50.           }
  51.         }
  52.         else {
  53.           if ($admin($3)) {
  54.             $read(bot\admin.txt,w,$3)
  55.             write -dl $+ $readn bot\admin.txt
  56.             .notice $nick %ctstart NoNick ( $+ $3 $+ ) was deleted as admin %ctstop
  57.           }
  58.           else {
  59.             .notice $nick %ctstart ERROR! NoNick ( $+ $3 $+ ) is not added as admin %ctstop
  60.           }
  61.         }
  62.       }
  63.       elseif ($2 == list) {
  64.         .notice $nick %ctstart Admin list: %ctstop
  65.         if ($lines(bot\admin.txt) < 1) {
  66.           .notice $nick %ctstart EMPTY %ctstop
  67.         }
  68.         var %x = 1
  69.         while (%x <= $lines(bot\admin.txt)) {
  70.           var %admin = $addtok(%admin,$chr(35) $+  $+ %x $+  $read(bot\admin.txt,%x) -,32)
  71.           if (%x == $lines(bot\admin.txt) || $numtok(%admin,32) >= 45 ) {
  72.             .notice $nick %ctstart $gettok(%admin,1- $+ $calc($numtok(%admin,32) - 1),32) %ctstop
  73.             unset %admin
  74.           }
  75.           inc %x
  76.         }
  77.         .notice $nick %ctstart End of list. %ctstop
  78.       }
  79.     }
  80.   }
  81.   if ($1 == .deop) {
  82.     if ($admin($address($nick,1)) && $2 isop $chan) {
  83.       set %opnick $2
  84.       who $2 n%uah
  85.     }
  86.   }
  87.   if ($1 == .op) {
  88.     if ($admin($address($nick,1))) {
  89.       if (!$2) {
  90.         .notice $nick %ctstart ERROR! You must specify a user or wildmark to op %ctstop  
  91.       }
  92.       else {
  93.         var %x = 1
  94.         while (%x <= $nick($chan,0,a,o)) {
  95.           if ($2 iswm $nick($chan,%x,a,o)) { var %opnow = $addtok(%opnow,$nick($chan,%x,a,o),32) }
  96.           var %opcounter = 0
  97.           if (%x == $nick($chan,0,a,o) || $numtok(%opnow,32) >= 18 ) {
  98.             .timer 1 %opcounter .msg q op $chan %opnow %ctstop
  99.             unset %opnow
  100.             inc %opcounter
  101.           }
  102.           inc %x
  103.         }
  104.       }
  105.     }
  106.   }
  107.   if ($1 == .autoop) {
  108.     if ($admin($address($nick,1))) {
  109.       if (%autoop == $2) {
  110.         .notice $nick %ctstart ERROR! AutoOp is already $2 %ctstop
  111.       }
  112.       else {
  113.         .notice $nick %ctstart Autoop is now $2 %ctstop
  114.         set %autoop $2
  115.         if ($2 == on) {
  116.           autoop
  117.           .timerautoop -o 0 5 autoop
  118.         }
  119.         elseif ($2 == off) {
  120.           .timerautoop off
  121.         }
  122.       }
  123.     }
  124.   }
  125.   if ($1 == .reop) {
  126.     reop $chan | notice $nick Done.
  127.   }
  128.   if ($1 == .saveop) {
  129.     saveop $chan | notice $nick Done.
  130.   }
  131.   if ($1 == .protect) {
  132.     if ($admin($address($nick,1))) {
  133.       if (%protect == $2) {
  134.         .notice $nick %ctstart ERROR! Protection is already $2 %ctstop
  135.       }
  136.       else {
  137.         .notice $nick %ctstart Protection is now $2 %ctstop
  138.         set %protect $2
  139.       }
  140.     }
  141.   }
  142. }
  143.  
  144. on *:KICK:#: {
  145.   if (!$admin($address($nick,1)) && %protect == on) {
  146.     set %fault Kick
  147.     inc %counter
  148.     who $nick n%uah
  149.   }
  150. }
  151.  
  152. on *:BAN:#: {
  153.   if (!$admin($address($nick,1)) && %protect == on) {
  154.     .msg q bandel $chan $banmask
  155.     set %fault Ban
  156.     inc %counter
  157.     if (!%ban) {
  158.       who $nick n%uah
  159.     }
  160.     set -u1 %ban 1
  161.   }
  162. }
  163.  
  164. on *:UNBAN:#: {
  165.   if (!$admin($address($nick,1)) && %protect == on) {
  166.     .msg q permban $chan $banmask
  167.     set %fault unBan
  168.     inc %counter
  169.     if (!%ban) {
  170.       who $nick n%uah
  171.     }
  172.     set -u1 %ban 1
  173.   }
  174. }
  175.  
  176. on *:MODE:#: {
  177.   if (!$admin($address($nick,1)) && %protect == on) {
  178.     .msg q clearchan $chan
  179.     set %fault change Mode
  180.     inc %counter
  181.     if (!%ban) {
  182.       who $nick n%uah
  183.     }
  184.     set -u1 %ban 1
  185.   }
  186. }
  187.  
  188. on *:TOPIC:#: {
  189.   if (!$admin($address($nick,1)) && %protect == on) {
  190.     set %fault change Topic
  191.     inc %counter
  192.     who $nick n%uah
  193.   }
  194. }
  195.  
  196. on *:OP:#: {
  197.   if (!$admin($address($nick,1)) && %protect == on) {
  198.     set %fault Op
  199.     set %opnick $opnick
  200.     inc %counter
  201.     who $opnick n%uah
  202.     who $nick n%uah
  203.   }
  204. }
  205.  
  206. on *:DEOP:#: {
  207.   if (!$admin($address($nick,1)) && %protect == on) {
  208.     .msg q op $chan $opnick
  209.     set %fault deOp
  210.     inc %counter
  211.     who $nick n%uah
  212.   }
  213. }
  214.  
  215. on *:VOICE:#: {
  216.   if (!$admin($address($nick,1)) && %protect == on) {
  217.     .msg q devoiceall $chan
  218.     set %fault Voice
  219.     inc %counter
  220.     who $nick n%uah
  221.   }
  222. }
  223.  
  224. on *:DEVOICE:#: {
  225.   if (!$admin($address($nick,1)) && %protect == on) {
  226.     .msg q voice $chan $vnick
  227.     set %fault deVoice
  228.     inc %counter
  229.     who $nick n%uah
  230.   }
  231. }
  232.  
  233. raw 354:*: {
  234.   /haltdef
  235.   if (%opnick) {
  236.     if ($4 == 0) {
  237.       .msg q deopall %channel
  238.       unset %opnick
  239.     }
  240.     else {
  241.       .msg q chanlev %channel $chr(35) $+ $4 +d
  242.       .msg q chanlev %channel $chr(35) $+ $4 -d
  243.       unset %opnick
  244.     }
  245.   }
  246.   else {
  247.     if ($4 != 0) {
  248.       .msg Q removeuser %channel $chr(35) $+ $4
  249.     }  
  250.     .msg Q permban %channel *!* $+ $2 $+ @ $+ $3 Killed (*.quakenet.org (Do NOT %fault without permission ( $+ ID: %counter $+ )))
  251.   }
  252. }
  253.  
  254.  
  255.  
  256.  
  257. alias owner {
  258.   if ($1 == *!*runeo@suspended.users.quakenet.org) {
  259.     return $true
  260.   }
  261.   if ($1 == *!*TheQBot@CServe.quakenet.org) {
  262.     return $true
  263.   }
  264. }
  265.  
  266. alias admin {
  267.   if ($owner($1)) {
  268.     return $true
  269.   }
  270.   if ($read(bot\admin.txt,w,$1)) {
  271.     return $true
  272.   }
  273. }
  274. alias reop {
  275.   var %t $ticks
  276.   var %nzz = $hget($+(reop.,$1),0).item
  277.   while (%nzz) {
  278.     if ($hget($+(reop.,$1),%nzz).item ison $1) && ($hget($+(reop.,$1),%nzz).item !isop $1) {
  279.       var %reopcounter = 0
  280.       if ($hget($+(reop.,$1),%nzz).item !isop $1) { var %opop = %opop $hget($+(reop.,$1),%nzz).item }
  281.       if ($gettok(%opop,0,32) == 6) { .timer 1 %reopcounter msg q op $1 %opop | unset %opop }
  282.       elseif ($gettok(%opop,0,32) < 6) && ($hget($+(reop.,$1),0).item <= 6) { msg q op $1 %opop  }
  283.       inc %reopcounter
  284.     }
  285.     dec %nzz
  286.   }
  287. }
  288.  
  289.  
  290.  
  291.  
  292. alias saveop {
  293.   var %t $ticks
  294.   if (!$1) { if ($isid) { return &#65533; DEBUG &#65533; Error: Synthax insufficient "channel" parameters &#65533; - $calc($ticks - %t) ms &#65533; } | else { echo -s ERROR Synthax insufficient "channel" parameters | halt } }
  295.   if ($hget($+(reop.,$1))) { hfree $+(reop.,$1) }
  296.   var %uu = $nick($1,0) | while (%uu) {
  297.  
  298.     var %nsop = $nick($1,%uu) | if (%nsop isop $1) {
  299.       if (%nsop != Q) && (%nsop != S) {
  300.         if (!$hget($+(reop.,$1))) hmake -w $+(reop.,$1) 600
  301.         if (!$hget($+(reop.,$1),%nsop)) hadd -w $+(reop.,$1) %nsop %nsop
  302.       }
  303.     }
  304.     dec %uu
  305.   }
  306.   if ($isid) { return &#65533; MSL &#65533; No Complications &#65533; - $calc($ticks - %t) ms &#65533; }
  307.   else { echo -s Ok No Complication }
  308. }
  309.  
  310.  
  311.  
  312. alias autoop {
  313.   var %x = 1
  314.   while (%x <= $nick(%channel,0,a,o)) {
  315.     var %opnow = $addtok(%opnow,$nick(%channel,%x),32)
  316.     var %opcounter = 0
  317.     if (%x == $nick(%channel,0,a,o) || $numtok(%opnow,32) >= 18 ) {
  318.       .timer 1 %opcounter .msg q op %channel %opnow %ctstop
  319.       unset %opnow
  320.       inc %opcounter
  321.     }
  322.     inc %x
  323.   }
  324. }