Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- FIQ-bot version 3.1
- Totally rewritten
- */
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; ;;;
- ;;; ALIASES ;;;
- ;;; ;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- alias urlencode return $regsubex($1-,/\G(.)/g,$iif(($prop && \1 !isalnum) || !$prop,$chr(37) $+ $base($asc(\1),10,16),\1))
- alias urldecode return $replace($regsubex($1-,/%(\w\w)/g,$chr($iif($base(\t,16,10) != 32,$v1,1))),$chr(1),$chr(32))
- alias chanlistglob { scid -at1 chanlistnet | var %tmp = $mid(%cl.buffer,2) | unset %cl.buffer | return %tmp }
- alias chanlistnet { set %cl.buffer $+(%cl.buffer,$chr(44),$network) | var %i = 1 | while ($comchan($me,%i)) { set %cl.buffer $+(%cl.buffer,$chr(44),$v1) | inc %i } }
- alias evalfix { return $(,$+(%,$1)) }
- alias getaccess {
- var %access = %fiqbot_access_ [ $+ [ $1 ] ]
- if (%access == 1) { return Normal user }
- elseif (%access == 9) { return Master }
- elseif (%access == 10) { return Admin }
- elseif (%access == 11) { return FireFly }
- elseif (!%access) { return Normal user }
- else { return User level %access }
- }
- alias initcmd {
- if ($1 == -in-channel) { if ($2 == Y) { unset %fiqbot* } }
- elseif ($?!="Do you want to unload all FIQ-bot variables?") { unset %fiqbot* }
- ;
- ;Not channel-specific commands
- ;
- set %fiqbot_cmd_access 9:[-crl] [nick/host] [level]:Add a nick's host or a host with userlevel [level]. With access-level 9 you can grant 8 or less, with level 10 you can grant full access. Use -r switch for removing access. Use -c switch for check access. Use -l switch for listing connected people with access.
- set %fiqbot_cmd_account 9:<password>:Creates an account that you can use in FIQ-bots web-interface (with current nick). If an account on your host already exists, changing password. It's highly recommended to run this command in query.
- set %fiqbot_cmd_alias 9:[-r] <name> [command]:Create an alias for another FIQ-bot command. Use -r to remove the alias. If no FIQ-bot command is used to set it as, it will show what the alias use right now.
- set %fiqbot_cmd_bf 1:<script>:Evalutes <script> in BF.
- set %fiqbot_cmd_config 10:<attribute> [value]:Changes the FIQ-bot config.
- set %fiqbot_cmd_constant 2:[-cdr] <name> [reply]:Make a custom command in FIQ-bot. The -c switch makes FIQ-bot reply in channel. The -r switch makes FIQ-bot use raw (level 5+). The -d switch deletes the constant. Use &sN for parameter N, &nick for the nick, &chan for the channel.
- set %fiqbot_cmd_gtfo 11:(nothing):Makes FIQ leave this network.
- set %fiqbot_cmd_deop 3:[#channel] <name>:Deops <name> in current channel, or if #channel is specified, deops in #channel.
- set %fiqbot_cmd_devoice 2:[#channel] <name>:Devoices <name> in current channel, or if #channel is specified, devoices in #channel.
- ;set %fiqbot_cmd_fnu 6:<operation> [parameters]:Makes an operation in fuska.nu (available is ADDFRIEND, SETPASSWORD (only for level 10, use in query), PM, REMOVEFRIEND)
- set %fiqbot_cmd_forceowner 10:(nothing):Forces ownership (access level 5) in current channel.
- set %fiqbot_cmd_function 9:<-h/name> [code]:Make a custom function in FIQ-bot. For info, type -h instead of a name.
- set %fiqbot_cmd_ghost 10:(nothing):Kills the FIQ online.
- set %fiqbot_cmd_help 1:<command>:Displays help about a command.
- set %fiqbot_cmd_join 5:<channel>:Makes FIQ-bot joining <channel>.
- set %fiqbot_cmd_kick 3:[#channel] <name> [reason]:Kicks <name> out of the current channel, or if #channel is specified, kicks from #channel. If [reason] is specified, it will be used as kick reason.
- set %fiqbot_cmd_mode 4:<nick/host/#channel> [+/-flags]:Sets <nick/host/#channel> with flags. If no flags is specified, show current flags. Nick flags is +b (auto-ban), +o (auto-op), +p (forces you to use prefix in query), +v (auto-voice). Channel flags is +j (joined - will not show join message if it's turned on - you cannot touch this flag), +p (no-prefix), +v (voiceall), +w (enable-welcome).
- set %fiqbot_cmd_official 1:(nothing):Sets the current channel to "official" and prevent the bot from joining this channel again. This can only be done by IRC Operators or people with user level 10 (Admin).
- set %fiqbot_cmd_op 3:[#channel] <name>:Ops <name> in current channel, or if #channel is specified, ops in #channel.
- set %fiqbot_cmd_part 5:<channel>:Makes FIQ-bot parting <channel>.
- set %fiqbot_cmd_prefix 9:[-s] [prefix]:Changes the prefix FIQ-bot use. Use -s switch for showing current prefix.
- set %fiqbot_cmd_reload 10:[-u]:Reloads variables. If -u switch is used, unsets all variables and makes you level 10.
- set %fiqbot_cmd_remote 10:<command>:Make FIQ-bot use a mIRC command with custom parameters.
- set %fiqbot_cmd_restart 10:(nothing):Restarts the process
- set %fiqbot_cmd_rpgstats 1:[-c] <ip>:Makes FIQ return stats in FIQ-RPG. The -c switch makes FIQ-bot reply in channel.
- set %fiqbot_cmd_showcommands -1:[filter]:Shows available commands. If [filter] is specified, showing only commands matching [filter]. Possibility to use ? for 1 char match and * for zero-or-more char match.
- set %fiqbot_cmd_source 10:(nothing):Sends you current source of FIQ-bot.
- set %fiqbot_cmd_todo 1:<add <text>/show>:Add a todo or show your todo list
- set %fiqbot_cmd_try 5:<statement>:Check if <statement> is true or false.
- set %fiqbot_cmd_typeof 1:<command>:Display type of the command <command> (normal, constant, channelconstant or rawconstant)
- set %fiqbot_cmd_version 1:(nothing):Return FIQ-bot version
- set %fiqbot_cmd_voice 2:[#channel] <name>:Voices <name> in current channel, or if #channel is specified, voices in #channel.
- set %fiqbot_cmd_welcome 4:<#channel> [message]:Gives you the welcome message of channel <#channel>. If [message] is specified, the welcome message is changed.
- set %fiqbot_cmd_whoami 1:(nothing):Display info about who you are for me.
- set %fiqbot_cmd_whois 1:<nick>:Displays info about <nick>.
- ;
- ;Channel-specific commands
- ;
- set %fiqbot_chcmd_ban 3:[-d] <#channel> [mask]:Bans [mask] in <#channel>. If mask is ommited, listing bans in <#channel>. Use -d to remove bans. This is the same as setting +b in chanuserflags.
- set %fiqbot_chcmd_chanaccess 1:[-d] <#channel> [nick/host] [new access level]:Deletes, changes, or views the access for [nick/host] in <#channel>. If nick/host is omitted, showing access list for <#channel>. Use -d to remove access
- ;
- ;Random stuff
- ;
- set %fiqbot_prefix !
- if ($1 == -in-channel) { if ($2 == Y) { set %fiqbot_access_ $+ $address($3,2) 10 } }
- else { set %fiqbot_access_*!*@ $+ $?="Enter the auth you want to give max-access to" $+ .users.quakenet.org 10 }
- if ($1 == -in-channel) {
- .notice $3 Loaded FIQ-bot version 3.1- $+ $iif($authinfo,main,alternate)
- }
- else {
- echo -ag Loaded FIQ-bot version 3.1- $+ $iif($authinfo,main,alternate)
- }
- }
- alias mIf {
- tokenize 32 $1-
- goto $0
- :3
- if ($1 $2 $3) { return $true } | return $false
- :2
- if ($1 $2) { return $true } | return $false
- :1
- if ($1) { return $true } | return $false
- return $false
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; ;;;
- ;;; EVENTS ;;;
- ;;; ;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- on *:START:{
- if (!%init_done) { initcmd | set %init_done 1 }
- }
- on *:CONNECT:{
- if ($authinfo) { .auth $authinfo }
- join #FIQ-bot
- }
- on *:JOIN:*:{
- if (%official_ [ $+ [ $chan ] ]) { part $chan Official channel | return }
- elseif ($nick == $me) {
- ;if (!%fiqbot_joinedbefore_ [ $+ [ $chan ] ]) { msg $chan Joined channel. If you want me to part (requires access-level 5), type !FIQ part. If this channel is an official network channel and you're an IRC Operator, type "!FIQ official" for preventing this channel from being joined in the future. You can also just ban me, but it will mean that I can join this channel in the future (if someone command me to join it). Join command used by: $iif(!%fiqbot_joinedby,(self/unknown),%fiqbot_joinedby) | set %fiqbot_joinedbefore_ [ $+ [ $chan ] ] 1 }
- }
- if ($evalfix(fiqbot_welcome_ $+ $chan)) && (%mode_w_ [ $+ [ $chan ] ]) { .notice $nick $chr(91) $+ $chan $+ $chr(93) $evalfix(fiqbot_welcome_ $+ $chan) }
- if ($me isop $chan) {
- if (%mode_o_ [ $+ [ $address($nick,2) ] ]) { mode $chan +o $nick }
- elseif (%mode_v_ [ $+ [ $address($nick,2) ] ]) { mode $chan +v $nick }
- elseif (%mode_b_ [ $+ [ $address($nick,2) ] ]) { mode $chan +b $address($nick,2) | kick $chan $nick Banned }
- elseif (%mode_v_ [ $+ [ $chan ] ]) { mode $chan +v $nick }
- }
- }
- on *:TEXT:!showprefix:*:.notice $nick Current prefix: %fiqbot_prefix
- on *:TEXT:QuakeNet Staff *:?:{
- if ((%ircopcheck) && ($nick == Q)) {
- set %official_ $+ %chan 1
- part %chan This channel will not be joined anymore.
- .notice %ircopcheck Done. Channel will now be prevented from joining.
- timerstaff off
- }
- unset %ircopcheck
- }
- on *:TEXT:*:*:{
- if ((!$chan) && (!%mode_p_ [ $+ [ $address($3,2) ] ])) { tokenize 32 a $1- }
- elseif (?FIQ iswm $1) { continue }
- elseif (($chan) && (%mode_p_ [ $+ [ $chan ] ]) && (%fiqbot_prefix == $left($1,1))) { tokenize 32 a $right($1-,-1) }
- else { return }
- if ($nick == $me) { return }
- if (!$chan) { continue }
- elseif ((%fiqbot_prefix == $left($1,1)) || (($1 == a) && (%mode_p_ [ $+ [ $chan ] ]))) { continue }
- else { return }
- goto $iif($(,$+(%,fiqbot_cmd_,$2)),$iif(($gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) <= 1 && (!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58))) || $gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) <= $(,$+(%,fiqbot_access_,$address($nick,2))),$iif($gettok($(,$+(%,fiqbot_cmd_,$2)),4,58),$gettok($(,$+(%,fiqbot_cmd_,$2)),4,58),$2),accdenied),unknowncmd)
- :accdenied
- .notice $nick Access denied. You need level $gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) $chr(124) You are: $getaccess($address($nick,2)) (level $iif(!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58),1,$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58)) $+ )
- return
- :unknowncmd
- if ($chan) goto $iif($(,$+(%,fiqbot_chcmd_,$2)),$iif(($gettok($(,$+(%,fiqbot_chcmd_,$2)),1,58) <= 1 && (!$gettok($(,$+(%,fiqbot_chanaccess_,$address($nick,2),$chan)),1,58))) || $gettok($(,$+(%,fiqbot_chcmd_,$2)),1,58) <= $(,$+(%,fiqbot_chanaccess_,$address($nick,2))),$iif($gettok($(,$+(%,fiqbot_chcmd_,$2)),4,58),$gettok($(,$+(%,fiqbot_chcmd_,$2)),4,58),$2),accdenied),unknowncmd2)
- :unknowncmd2
- if ($gettok($(,$+(%,fiqbot_cmd_,$2)),4,58)) { goto $2 }
- if ($exists($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq))) {
- set -u1 % $+ $2 $+ _ $+ nick $nick
- set -u1 % $+ $2 $+ _ $+ chan $chan
- if ($right($gettok($read($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq),1),1,32),-1) > %fiqbot_access_ [ $+ [ $address($nick,2) ] ]) { .notice $nick Access denied. You need level $right($gettok($read($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq),1),1,32),-1) $chr(124) You are: $getaccess($address($nick,2)) (level $iif(!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58),1,$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58)) $+ ) | return }
- load -rs $qt($mircdirFIQ-bot\ $+ $2 $+ .fiq)
- }
- elseif (%addon_ [ $+ [ $2 ] ]) { %addon_cmd_ [ $+ [ $2 ] ] $nick $chan $3- | return }
- elseif (%constant_ [ $+ [ $2 ] ]) {
- if (%constantInChannel_ [ $+ [ $2 ] ]) { msg $chan $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
- elseif (%constantUseRaw_ [ $+ [ $2 ] ]) { raw $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
- else { .notice $nick $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
- return
- }
- elseif (%function_ [ $+ [ $2 ] ]) {
- unset %cmd
- var %script = temp_function_ $+ $2
- var %line 1
- var %x = 1
- var %rand = $rand(1,10000)
- var %chan_ [ $+ [ %rand ] ] $chan
- var %nick_ [ $+ [ %rand ] ] $nick
- var %time_ [ $+ [ %rand ] ] $time
- var %me_ [ $+ [ %rand ] ] $me
- var %string = $1-
- while (%x <= $len(%function_ [ $+ [ $2 ] ])) {
- var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1)
- .echo -atg Debug: While fortsätter! Kommandostring: %cmd - Det är if? $iif(%cmd == if,Japp,Nä)
- if ((%char == $chr(125)) && (%ifStatementProgress)) { inc %x | unset %cmd | unset %space* | var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1) | unset %ifStatementProgress | unset %statementIsTrue }
- elseif (%char == ;) {
- .echo -atg Debug: Kommando upptäckt! Kommandostring: %cmd
- tokenize 32 %cmd
- var %cmdUsed = $1
- if ((%ifStatementProgress) && (!%statementIsTrue)) { xyzzy }
- elseif ($2 == =) {
- if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
- elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
- if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
- if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $noqt($3-) }
- elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
- }
- else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
- }
- elseif ($2 == .=) {
- if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
- elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
- if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
- if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $+ $noqt($3-) }
- elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $+ % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
- }
- else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
- }
- elseif (($1 == msg) || ($1 == notice) || ($1 == action) || ($1 == ctcp) || ($1 == ctcpreply)) {
- echo -agt Debug: Msg-kommando detected!
- if (($left($2,1) == ") || ($3 isnum)) { var %msgTarget = $noqt($2) }
- elseif (% [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %msgTarget = % [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-2 $+ ' Variable " $+ $2 $+ " is unknown or undefined. | return }
- if (($left($3-,1) == ") || ($3 isnum)) { var %message = $noqt($3-) }
- elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %message = % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
- echo -atg Debug: %msgTarget - %message
- if ($1 == ctcp) { msg %msgTarget $chr(1) $+ %message $+ $chr(1) }
- elseif ($1 == ctcpreply) { notice %msgTarget $chr(1) $+ %message $+ $chr(1) }
- elseif ($1 == action) { msg %msgTarget $chr(1) $+ ACTION %message $+ $chr(1) }
- else { $1 %msgTarget %message }
- }
- elseif ($1 == if) { .notice $nick Error near ' $+ $1- $+ ' - the if statement couldn't be parsed. | return }
- else { .notice $nick Error near ' $+ $1- $+ ' - command " $+ $1 $+ " is unknown. | return }
- ;raw %cmd
- unset %cmd
- tokenize 32 %string
- }
- elseif ($asc(%char) == 32) { echo -agt Debug: Space progressas! | var %spaceIsGoingToSet = 1 }
- elseif (%space) { echo -agt Debug: Space detected! | %cmd = %cmd %char | unset %space* }
- else { %cmd = %cmd $+ %char }
- if (%spaceIsGoingToSet) { %cmd = %cmd $+ %char }
- ;echo -atg Debug: % $+ x -> %x $+ , % $+ cmd -> %cmd
- inc %x
- if (%spaceIsGoingToSet) { var %space = 1 }
- if (%cmd == if) {
- unset %z
- unset %whilestop
- while (!%whilestop) {
- var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1)
- if ($asc(%char) == 32) { echo -agt Debug: Space progressas! | var %spaceIsGoingToSet = 1 }
- elseif (%space) { inc %z | %cmd = %cmd %char | unset %space* }
- else { %cmd = %cmd $+ %char }
- if (%z == 4) { var %whilestop = 1 }
- else { echo -atg Debug: %z }
- if (%spaceIsGoingToSet) { %cmd = %cmd $+ %char }
- inc %x
- if (%spaceIsGoingToSet) { echo -agt Spacevariabel settas! | var %space = 1 }
- if (!%char) { .notice $nick Error near ' $+ %cmd $+ ' - Unknown error. | return }
- }
- tokenize 32 %cmd
- var %cmdUsed = $1
- if ($left($2,1) != $chr(40)) { .notice $nick Error near ' $+ $1-2 $+ ' - no starting paranthesis in the if. | return }
- if ($right($4,1) == $chr(41)) { xyzzy }
- else { .notice $nick Error near ' $+ $1-4 $+ ' - no closing paranthesis on right place. (charcheck: $right($4,1) $+ ) | return }
- if (($3 != ==) && ($3 != >) && ($3 != <) && ($3 != <=) && ($3 != >=) && ($3 != !=)) { .notice $nick Error near ' $+ $1-3 $+ ' - unknown operator. | return }
- if ($right($left($2,2),1) == ") { var %v1 = $noqt($left($2,-1)) }
- elseif (% [ $+ [ $right($2,-1) ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %v1 = % [ $+ [ $right($2,-1) ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-2 $+ ' - Variable " $+ $right($2,-1) $+ " is unknown or undefined. | return }
- if ($left($4,1) == ") { var %v2 = $noqt($left($4,-1)) }
- elseif (% [ $+ [ $right($4,-1) ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %v2 = % [ $+ [ $right($4,-1) ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-4 $+ ' - Variable " $+ $left($4,-1) $+ " is unknown or undefined. | return }
- if (%v1 $3 %v2) { var %statementIsTrue = 1 }
- if ($5 != $chr(123)) { .notice $nick Error near ' $+ $1-5 $+ ' - missing opening bracket. | return }
- var %ifStatementProgress = 1
- inc %x %cmd
- unset %cmd
- tokenize 32 %string
- }
- else { echo -atg Kommandot är ingen if, det är: " $+ %cmd $+ ", alltså en if enligt $chr(36) $+ iif? $iif(%cmd == if,Japp,Nä) }
- }
- if (%cmd) {
- tokenize 32 %cmd
- if ($1 == $chr(125)) { return }
- var %cmdUsed = $1
- if ($2 == =) {
- if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
- elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
- if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
- if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $noqt($3-) }
- elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
- }
- else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
- }
- elseif (($1 == msg) || ($1 == notice) || ($1 == action) || ($1 == ctcp) || ($1 == ctcpreply)) {
- echo -agt Debug: Msg-kommando detected!
- if (($left($2,1) == ") || ($3 isnum)) { var %msgTarget = $noqt($2) }
- elseif (% [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %msgTarget = % [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-2 $+ ' Variable " $+ $2 $+ " is unknown or undefined. | return }
- if (($left($3-,1) == ") || ($3 isnum)) { var %message = $noqt($3-) }
- elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %message = % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
- else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
- echo -atg Debug: %msgTarget - %message
- if ($1 == ctcp) { msg %msgTarget $chr(1) $+ %message $+ $chr(1) }
- elseif ($1 == ctcpreply) { notice %msgTarget $chr(1) $+ %message $+ $chr(1) }
- elseif ($1 == action) { msg %msgTarget $chr(1) $+ ACTION %message $+ $chr(1) }
- else { $1 %msgTarget %message }
- }
- else { .notice $nick Error near ' $+ $1- $+ ' command " $+ $1 $+ " is unknown. | return }
- ;raw %cmd
- unset %cmd
- tokenize 32 %string
- }
- return
- }
- else { .notice $nick Unknown command ( $+ $2 $+ ). For a list of commands, type !FIQ SHOWCOMMANDS }
- return
- :ACCESS
- if ((!$4) && ($3 != -l)) { .notice $nick Syntax: !FIQ ACCESS [-crl] [nick/host] [level] | return }
- if ($3 == -r) {
- if ($address($4,2)) {
- if ($getaccess($address($nick,2)) == Admin) { unset %fiqbot_access_ [ $+ [ $address($4,2) ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess($address($4,2)) }
- else {
- if ($evalfix(fiqbot_access_ $+ $address($4,2)) > 8) { .notice $nick You cannot remove access from $4 $+ . User is $getaccess($address($4,2)) | return }
- unset %fiqbot_access_ [ $+ [ $address($4,2) ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess($address($4,2))
- }
- }
- else {
- if (!%fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ]) { .notice $nick Host $4 doesn't exists. | return }
- if ($getaccess($address($nick,2)) == Admin) { unset %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess(*!*@ $+ $4) }
- else {
- if ($evalfix(fiqbot_access_*!*@ $+ $4) > 8) { .notice $nick You cannot remove access from $4 $+ . User is $getaccess(*!*@ $+ $4) | return }
- unset %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess(*!*@ $+ $4)
- }
- }
- }
- elseif ($3 == -c) {
- if ($address($4,2)) { .notice $nick Address: $address($4,5) $chr(124) FIQ-bot access: $getaccess($address($4,2)) }
- else { .notice $nick Address: $ial(* $+ $4,1) $chr(124) FIQ-bot access: $getaccess(*!*@ $+ $4) }
- }
- elseif ($3 == -l) {
- .notice $nick Listing connected people with access -1 or 2+ (level:nick)
- var %i = 1
- while ($var(fiqbot_access_*,%i)) {
- echo -agt Debug: $var(fiqbot_access_*,%i) och address är $right($var(fiqbot_access_*,%i),-15)
- if ($ial($right($var(fiqbot_access_*,%i),-15),1)) var %buffer = %buffer $(,$var(fiqbot_access_*,%i)) $+ : $+ $gettok($ial($right($var(fiqbot_access_*,%i),-15),1),1,33) $+ $chr(44)
- inc %i
- }
- .notice $nick $iif(!%buffer,(none),$left(%buffer,-1))
- }
- else {
- if ($address($3,2)) {
- if ($getaccess($address($nick,2)) == Admin) { set %fiqbot_access_ [ $+ [ $address($3,2) ] ] $iif($4 > 10,10,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess($address($3,2)) }
- else {
- if ($evalfix(fiqbot_access_ $+ $address($3,2)) > 8) { .notice $nick You cannot change access for $3 $+ . User is $getaccess($address($3,2)) | return }
- set %fiqbot_access_ [ $+ [ $address($3,2) ] ] $iif($4 > 8,8,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess($address($3,2))
- }
- }
- else {
- if ($getaccess($address($nick,2)) == Admin) { set %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $3 ] ] $iif($4 > 10,10,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess(*!*@ $+ $3) }
- else {
- if ($evalfix(fiqbot_access_*!*@ $+ $3) > 8) { .notice $nick You cannot remove access from $3 $+ . User is $getaccess(*!*@ $+ $3) | return }
- set %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] $iif($4 > 8,8,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess(*!*@ $+ $3)
- }
- }
- }
- return
- :ACCOUNT
- if (!$authinfo) { .notice $nick This feature is only available in 3.0-main. | return }
- if (!$3) { .notice $nick Syntax: !FIQ ACCOUNT <password> | return }
- else {
- set -u1 %nick $iif(!$evalfix(nick_ $+ $address($nick,2)),$nick,$evalfix(nick_ $+ $address($nick,2)))
- set %nick_ $+ $address($nick,2) $nick
- set -u1 %password $3
- set -u1 %accesslevel %fiqbot_access_ [ $+ [ $address($nick,2) ] ]
- sockopen localhost 127.0.0.1 80
- }
- return
- :ALIAS
- if ((!$3) || (($3 == -r) && (!$4))) { .notice $nick Syntax: !FIQ ALIAS [-r] <name> [command] | return }
- if ($3 == -r) {
- if (!$gettok($(,$+(%,fiqbot_cmd_,$4)),4,58)) { .notice $nick Alias doesn't exists. | return }
- else { unset %fiqbot_cmd_ [ $+ [ $4 ] ] | .notice $nick Done }
- }
- else {
- if (!$4) {
- if (!$gettok($(,$+(%,fiqbot_cmd_,$3)),4,58)) { .notice $nick Alias doesn't exists. | return }
- else { .notice $nick $3 is alias for the command: $gettok($(,$+(%,fiqbot_cmd_,$3)),4,58) }
- }
- else {
- if (($(,$+(%,fiqbot_cmd_,$3))) && (!$gettok($(,$+(%,fiqbot_cmd_,$3)),4,58))) { .notice $nick You cannot override default commands. | return }
- else {
- if (!$gettok($(,$+(%,fiqbot_cmd_,$4)),1,58)) { .notice $nick $4 is an unknown command. | return }
- elseif ($gettok($(,$+(%,fiqbot_cmd_,$4)),4,58)) { .notice $nick You can't create an alias for an alias. | return }
- else { set %fiqbot_cmd_ $+ $3 $gettok($(,$+(%,fiqbot_cmd_,$4)),1,58) $+ : $+ $gettok($(,$+(%,fiqbot_cmd_,$4)),2,58) $+ : $+ $gettok($(,$+(%,fiqbot_cmd_,$4)),3,58) $+ : $+ $4 | .notice $nick Done }
- }
- }
- }
- return
- :BAN
- .notice $nick Not yet.
- return
- :BF
- if (!$3) { .notice $nick Syntax: !FIQ BF <script> | return }
- useBf $nick $3-
- return
- :CHANACCESS
- .notice $nick Not yet.
- return
- :CONFIG
- if ($3 == list) { .notice $nick sendMsgInChannel: %fiqconfig_sendMsgInChannel $chr(124) phpLikeErrors: %fiqconfig_phpLikeErrors }
- else { set %fiqconfig_ $+ $3 $4- | .notice $nick Done }
- return
- :CONSTANT
- if (!$4) { .notice $nick Syntax: FIQ constant <keyword> <text>. Parameter support: &s(para-number) | return }
- if ($3 == -c) {
- if ($evalfix(fiqbot_cmd_ $+ $4)) { .notice $nick Command $4 already exists. | return }
- set %constant_ $+ $4 $5-
- set %constantInChannel_ $+ $4 1
- }
- elseif ($3 == -r) {
- if ($evalfix(fiqbot_cmd_ $+ $4)) { .notice $nick Command $4 already exists. | return }
- if ($evalfix(fiqbot_access_ $+ $address($nick,2)) > 4) { set %constantUseRaw_ $+ $4 1 }
- set %constant_ $+ $4 $5-
- }
- elseif ($3 == -d) {
- if (!$evalfix(constant_ $+ $4)) { .notice $nick Constant " $+ $4 $+ " doesn't exists. | return }
- unset %constant_ [ $+ [ $4 ] ]
- unset %constantInChannel_ [ $+ [ $4 ] ]
- unset %constantUseRaw_ [ $+ [ $4 ] ]
- }
- else {
- if ($evalfix(fiqbot_cmd_ $+ $3)) { .notice $nick Command $3 already exists. | return }
- set %constant_ $+ $3 $4-
- }
- .notice $nick Done.
- return
- :DEOP
- if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
- if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
- else { var %chan = $chan | var %nick = $3 }
- if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
- if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
- mode %chan -o %nick
- .notice $nick Done.
- return
- :DEVOICE
- if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
- if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
- else { var %chan = $chan | var %nick = $3 }
- if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
- if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
- mode %chan -v %nick
- .notice $nick Done.
- return
- :FORCEOWNER
- set %fiqbot_chaccess_ $+ $address($nick,2) $+ $chan 5
- .notice $nick Done.
- return
- :FNU
- .notice $nick Not yet.
- return
- :FUNCTION
- if (!$3) { .notice $nick Syntax: !FIQ FUNCTION <-h/name> [code] | return }
- elseif ($3 != -h) {
- if (!$4) { .notice $nick $3 contains following code: $evalfix(function_ $+ $3) | return }
- set %function_ $+ $3 $4-
- .notice $nick Done.
- }
- else {
- if ($4 == 2) {
- .notice $nick Page 2 - The [[nick]] used in the "hre" command was a function that returned something. We can call it a identifier. There's many types of default functions. Others is [[chan]], [[time]], [[str]],
- .notice $nick [[me]] doing different things. [[chan]], [[time]] and [[me]] works the same as [[nick]] but instead, [[chan]] shows channel, [[time]] current time, [[me]] the botnick.
- .notice $nick But functions also can take parameters, as the [[str]] one. For more help, write !FIQ function -h 3
- }
- elseif ($4 == 3) {
- .notice $nick Page 3 - The [[str]] function can take one parameter, a number. The number shows the parameter used in the functions.
- .notice $nick Example: If you write this function: !FIQ function hre NOTICE [[nick]] :A parameter: [[str|1]], and then use the function, it will return "A parameter:". Now try write !FIQ hre random
- .notice $nick As you see, it returned "A parameter: random" in a notice. For more help, write !FIQ function -h 4
- }
- elseif ($4 == 4) {
- .notice $nick Page 4 - You can also make own identifiers and use them in your functions for returning data.
- .notice $nick using the RETURN "special" command. For example, making a "hre2" identifier returning "A nice identifier!", write !FIQ FUNCTION hre2 return A nice identifier!
- .notice $nick You can now return "A nice identifier!" only with typing [[hre2]] in your "hre" function. For more help, write !FIQ function -h 5
- }
- elseif ($4 == 5) {
- .notice $nick Page 5 - You can also makes custom functions that take parameters. The parameters used is obetainable with "[[str|N]]" (N = number), just like in a normal function.
- .notice $nick For more help, type !FIQ functions -h 6
- }
- elseif ($4 == 6) {
- .notice $nick Page 6 - If statements: If statements is commonly used in more normal scripting and if you're common with it, you already know how it works. If not, an if statement is used to check
- .notice $nick if something is true or false and then execute something. An if in FIQ-bot-functions is used this way: "if (statement) $chr(123) command1;command2; $chr(125) $+ ". There's no elseif/else at this moment.
- .notice $nick Current operators is == (is equal to), != (is NOT equal to), < (is more than), > (is less than).
- }
- else {
- .notice $nick Page 1 - FIQ-bot supports making own type of functions. You call them as a normal command/constant. Commands is RAW-based but there exists "special" commands. The seperator between commands used is ";".
- .notice $nick For example, writing a function returning "abc" in a msg and is named "hre", you write: !FIQ function hre msg nick "abc"
- .notice $nick For more help, write !FIQ function -h 2
- }
- }
- return
- :GTFO
- .msg FIQ !!gtfo
- .msg FredrIQ !!gtfo
- .msg Fredrik1994 !!gtfo
- .notice $nick Done.
- return
- :GHOST
- if (!$authinfo2) { .notice $nick Cannot find auth information, this problably means that this version is 3.0-alternate. | return }
- ns ghost $authinfo2
- .notice $nick Done.
- return
- :HELP
- if (!$3) { .notice $nick For commands, type SHOWCOMMANDS. For help about a specific command, type !FIQ HELP <command> | return }
- elseif (!$(,$+(%,fiqbot_cmd_,$3))) && (!$(,$+(%,fiqbot_chcmd_,$3))) { .notice $nick Unknown command: $3 $+ . | return }
- elseif (!$(,$+(%,fiqbot_cmd_,$3))) { var %fiqbot_cmd_ $+ $3 %fiqbot_chcmd_ [ $+ [ $3 ] ] | var %x 1 }
- .notice $nick Syntax: !FIQ $3 $remove($gettok($(,$+(%,fiqbot_cmd_,$3)),2,58),(nothing)) $chr(124) Access level: $gettok($(,$+(%,fiqbot_cmd_,$3)),1,58)
- .notice $nick $gettok($(,$+(%,fiqbot_cmd_,$3)),3,58)
- if ($gettok($(,$+(%,fiqbot_cmd_,$3)),4,58)) { .notice $nick $3 is an alias for the command: $gettok($(,$+(%,fiqbot_cmd_,$3)),4,58) }
- .return
- :JOIN
- if (!$3) { .notice $nick Syntax: !FIQ JOIN <channel> | return }
- if (%official_ [ $+ [ $gettok($3,1,44) ] ]) { .notice $nick This channel is official. The channel couldn't be joined. | return }
- set -u3 %fiqbot_joinedby $nick
- join $gettok($3,1,44)
- .notice $nick Done.
- return
- :KICK
- if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> [reason] | return }
- if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 | var %reason = $5- }
- else { var %chan = $chan | var %nick = $3 | var %reason = $4- }
- if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
- if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
- if (%nick == $me) { .notice $nick I don't kick myself. | return }
- kick %chan %nick %reason
- .notice $nick Done.
- return
- :MODE
- if (!$3) { .notice $nick Syntax: !FIQ MODE <nick/host> [flags] | return }
- if ($left($3,1) == $chr(35)) {
- if (!$4) {
- var %buffer = +
- if (%fiqbot_joinedbefore_ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ j }
- if (%mode_p_ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ p }
- if (%mode_v_ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ v }
- if (%mode_w_ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ w }
- .notice $nick Flags in this channel: $iif(%buffer != +,%buffer,(none))
- }
- else {
- if ($left($4,1) == +) {
- if (p isin $4) { set %mode_p_ [ $+ [ $3 ] ] 1 }
- if (v isin $4) { set %mode_v_ [ $+ [ $3 ] ] 1 }
- if (w isin $4) { set %mode_w_ [ $+ [ $3 ] ] 1 }
- }
- elseif ($left($4,1) == -) {
- if (p isin $4) { unset %mode_p_ [ $+ [ $3 ] ] }
- if (v isin $4) { unset %mode_v_ [ $+ [ $3 ] ] }
- if (w isin $4) { unset %mode_w_ [ $+ [ $3 ] ] }
- }
- .notice $nick Done.
- }
- }
- elseif ($ial($3 $+ *)) {
- if (!$4) {
- var %buffer = +
- if (%mode_b_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ b }
- if (%mode_o_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ o }
- if (%mode_p_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ p }
- if (%mode_v_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ v }
- .notice $nick Flags for $3 $+ : $iif(%buffer != +,%buffer,(none))
- }
- else {
- if ($left($4,1) == +) {
- if (b isin $4) { set %mode_b_ [ $+ [ $address($3,2) ] ] 1 }
- if (o isin $4) { set %mode_o_ [ $+ [ $address($3,2) ] ] 1 }
- if (p isin $4) { set %mode_p_ [ $+ [ $address($3,2) ] ] 1 }
- if (v isin $4) { set %mode_v_ [ $+ [ $address($3,2) ] ] 1 }
- }
- elseif ($left($4,1) == -) {
- if (b isin $4) { unset %mode_b_ [ $+ [ $address($3,2) ] ] }
- if (o isin $4) { unset %mode_o_ [ $+ [ $address($3,2) ] ] }
- if (p isin $4) { unset %mode_p_ [ $+ [ $address($3,2) ] ] }
- if (v isin $4) { unset %mode_v_ [ $+ [ $address($3,2) ] ] }
- }
- .notice $nick Done.
- }
- }
- else {
- if (!$4) {
- var %buffer = +
- if (%mode_a_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ a }
- if (%mode_b_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ b }
- if (%mode_g_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ g }
- .notice $nick Flags for $3 $+ : $iif(%buffer != +,%buffer,(none))
- }
- else {
- if ($left($4,1) == +) {
- if (a isin $4) { set %mode_a_*!*@ [ $+ [ $3 ] ] 1 }
- if (b isin $4) { set %mode_b_*!*@ [ $+ [ $3 ] ] 1 }
- if (g isin $4) { set %mode_g_*!*@ [ $+ [ $3 ] ] 1 }
- }
- elseif ($left($4,1) == -) {
- if (a isin $4) { unset %mode_a_*!*@ [ $+ [ $3 ] ] }
- if (b isin $4) { unset %mode_b_*!*@ [ $+ [ $3 ] ] }
- if (g isin $4) { unset %mode_g_*!*@ [ $+ [ $3 ] ] }
- }
- .notice $nick Done.
- }
- }
- return
- :OFFICIAL
- if ($getaccess($address($nick,2)) != Admin) {
- set -u3 %ircopcheck $nick
- set -u3 %chan $chan
- msg q whois $nick
- timerstaff 1 3 .notice $nick You haven't enough access and you're not an IRC Operator (or the status couldn't be detected)
- }
- else {
- set %official_ $+ $chan 1
- part $chan This channel will not be joined anymore.
- .notice $nick Done. Channel will now be prevented from joining.
- }
- return
- :OP
- if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
- if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
- else { var %chan = $chan | var %nick = $3 }
- if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
- if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
- mode %chan +o %nick
- .notice $nick Done.
- return
- :PART
- if (!$3) { if ($chan == #FIQ-bot) { .notice $nick I don't part this channel. | return } | else { part $chan | .notice $nick Done. | return } }
- if ($3 == #FIQ-bot) { .notice $nick I don't part that channel. | return }
- part $3
- .notice $nick Done.
- return
- :PREFIX
- if (!$3) { .notice $nick Syntax: %fiqbot_prefix $+ FIQ PREFIX [-s] [prefix] | return }
- if ($3 == -s) { .notice $nick Current prefix: %fiqbot_prefix }
- else { set %fiqbot_prefix $left($3,1) | .notice $nick Done }
- return
- :RELOAD
- if ($3 == -u) { initcmd -in-channel Y $nick }
- else { initcmd -in-channel N $nick }
- return
- :REMOTE
- if (1 == 1) { $3- }
- else {
- .notice $nick Remote disabled for security reasons.
- }
- return
- :RESTART
- .notice $nick Restarting...
- !exit -rn
- return
- :RPGSTATS
- var %ip = $iif($3 == -c,$4,$3)
- if ($3 == -c) { msg $chan Level: $evalfix(level_ $+ %ip) - EXP: $evalfix(exp_ $+ %ip) $+ / $+ $getExpToLevel($evalfix(level_ $+ %ip)) }
- else { .notice $nick Level: $evalfix(level_ $+ %ip) - EXP: $evalfix(exp_ $+ %ip) $+ / $+ $getExpToLevel($evalfix(level_ $+ %ip)) }
- return
- :SHOWCOMMANDS
- .notice $nick Following commands are available for you with access " $+ $getaccess($address($nick,2)) $+ ":
- var %i = 1
- while ($var(fiqbot_cmd_*,%i)) {
- if (($gettok($(,$var(fiqbot_cmd_*,%i)),1,58) <= $evalfix(fiqbot_access_ $+ $address($nick,2))) || (($gettok($(,$var(fiqbot_cmd_*,%i)),1,58) <= 1) && (!$evalfix(fiqbot_access_ $+ $address($nick,2))))) { if ((!$3) || ($3 iswm $right($var(fiqbot_cmd_*,%i),-12))) var %buffer = %buffer $right($var(fiqbot_cmd_*,%i),-12) $+ $chr(44) }
- inc %i
- }
- var %i = 1
- while ($var(constant_*,%i)) { var %buffer2 = %buffer2 $right($var(constant_*,%i),-10) $+ $chr(44) | inc %i }
- .notice $nick Normal commands: $iif(!$upper($left(%buffer,-1)),(none),$upper($left(%buffer,-1))) $chr(124) Constants: $iif(!$upper($left(%buffer2,-1)),(none),$upper($left(%buffer2,-1)))
- return
- :SOURCE
- .notice $nick Sending source. PATH: $script $chr(124) MIRCDIR: $mircdir $chr(124) MIRCEXE: $mircexe
- dcc send $nick $script
- return
- :TODO
- if (!$3) { .notice $nick Syntax: FIQ TODO <show/add/done/clear> | return }
- if ($3 == show) {
- var %i = 1
- while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) { inc %i }
- if (%i > 5) {
- var %i = 1
- .notice $nick Todos för $nick $+ :
- while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) {
- unset %alreadySentAll
- if ($calc(%i % 5) == 1) { var %todobuffer * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ] }
- else { var %todobuffer %todobuffer $chr(124) * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ] }
- if ($calc(%i % 5) == 0) { .notice $nick %todobuffer | %alreadySentAll = 1 }
- inc %i
- }
- if (!%alreadySentAll) { .notice $nick %todobuffer | %alreadySentAll = 1 }
- }
- elseif (%i == 1) { .notice $nick Du har inga todos atm. }
- else {
- var %i = 1
- .notice $nick Todos för $nick $+ :
- while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) {
- .notice $nick * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]
- inc %i
- }
- }
- }
- elseif ($3 == add) {
- if (!$4) { .notice Please type at least 1 word. | return }
- var %i = 1
- while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) { inc %i }
- set %todo_ $+ %i $+ _ $+ $address($nick,2) $4-
- .notice $nick Added todo %i $+ : $4-
- }
- return
- :TRY
- var %tmp = $(,$3-5)
- .notice $nick STATEMENT $3-5 $chr(124) RETURNED: $mif(%tmp)
- return
- :TYPEOF
- if (!$3) { .notice $nick Syntax: !FIQ TYPEOF <command> | return }
- if (%constantUseRaw_ [ $+ [ $3 ] ]) { var %type = rawconstant }
- elseif (%constantInChannel_ [ $+ [ $3 ] ]) { var %type = channelconstant }
- elseif (%constant_ [ $+ [ $3 ] ]) { var %type = constant }
- elseif (%addon_ [ $+ [ $3 ] ]) { var %type = addon }
- elseif ($gettok(%fiqbot_cmd_ [ $+ [ $3 ] ],4,58) { var %type = alias }
- elseif (%fiqbot_cmd_ [ $+ [ $3 ] ]) { var %type = normal }
- else { .notice $nick Command $3 doesn't exists. | return }
- .notice $nick Type of $3 is " $+ %type $+ ".
- return
- :VERSION
- .notice $nick FIQ-bot version 3.1- $+ $iif($authinfo,main,alternate)
- return
- :VOICE
- if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
- if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
- else { var %chan = $chan | var %nick = $3 }
- if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
- if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
- mode %chan +v %nick
- .notice $nick Done.
- return
- :WELCOME
- if (!$3) { .notice $nick Syntax: !FIQ WELCOME <#channel> [message] | return }
- if ($left($3,1) != $left($chan,1)) { .notice $nick Illegal channel name: $3 | return }
- if (!$4) { .notice $nick Welcome message for $3 is: $iif(%fiqbot_welcome_ [ $+ [ $3 ] ],%fiqbot_welcome_ [ $+ [ $3 ] ],(none)) | return }
- set %fiqbot_welcome_ [ $+ [ $3 ] ] $4-
- .notice $nick Done.
- return
- :WHOAMI
- var %buffer = +
- if (%mode_a_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ a }
- if (%mode_b_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ b }
- if (%mode_g_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ g }
- .notice $nick Address: $address($nick,5) $chr(124) Your FIQ-bot access: $getaccess($address($nick,2)) $chr(124) You have following flags set: $iif(%buffer != +,%buffer,(none))
- return
- :WHOIS
- if (!$3) { .notice $nick Syntax: !FIQ WHOIS <nick> }
- if (!$ial($3)) { .notice $nick $3 doesn't exists, aren't connected or aren't on any channels with me. | return }
- var %buffer = +
- if (%mode_a_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ a }
- if (%mode_b_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ b }
- if (%mode_g_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ g }
- .notice $nick Address: $address($3,5) $chr(124) FIQ-bot access: $getaccess($address($3,2)) $chr(124) $3 has following flags set: $iif(%buffer != +,%buffer,(none))
- return
- :error
- tokenize 40 $error
- if (%fiqconfig_sendMsgInChannel) { %sendType = msg $chan }
- else { %sendType = .notice $nick }
- if (!%script) { var %script = $script | var %line = $mid($error, $calc($len($error) - $len($left($error,- $+ $calc($len($script) + 2)))), 4) }
- if (%fiqconfig_phpLikeErrors) { %sendType $iif(c isincs $chan(#).mode,Error: $1 in %script on line %line,Error: $1 in %script on line %line) }
- else { %sendType Error: $error }
- .reseterror
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; ;;;
- ;;; SOCKETS ;;;
- ;;; ;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;
- on *:sockopen:localhost:{
- ;to tell the server which file you want to receive
- sockwrite -n $sockname GET /fiq-bot/addUser.php?level= $+ %accesslevel $+ &username= $+ %nick $+ &password= $+ %password $+ &host= $+ $address(%nick,2) HTTP/1.0
- sockwrite -n $sockname Host: 127.0.0.1
- ;this is only needed for a few websites, but it's just more complete to have it ;)
- sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
- sockwrite -n $sockname Connection: Keep-Alive
- sockwrite -n $sockname $crlf
- }
- on *:sockopen:localhost2:{
- ;to tell the server which file you want to receive
- sockwrite -n $sockname GET /fiq-bot/update.php?channels= $+ $urlencode($chanlistglob) HTTP/1.0
- sockwrite -n $sockname Host: 127.0.0.1
- ;this is only needed for a few websites, but it's just more complete to have it ;)
- sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
- sockwrite -n $sockname Connection: Keep-Alive
- sockwrite -n $sockname $crlf
- }
- on *:sockopen:localhost3:{
- ;to tell the server which file you want to receive
- sockwrite -n $sockname GET /fiq-bot/cmdinfo.php HTTP/1.0
- sockwrite -n $sockname Host: 127.0.0.1
- ;this is only needed for a few websites, but it's just more complete to have it ;)
- sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
- sockwrite -n $sockname Connection: Keep-Alive
- sockwrite -n $sockname $crlf
- }
- on *:sockread:localhost:{
- ;same way as in mirc helpfile with the :nextread
- if ($sockerr > 0) .notice %nick Error! $sockerr
- :nextread
- sockread %temp
- tokenize 32 %temp
- if ($1 == FIQBOTECHO:) { .notice %nick $2- }
- echo -s Content: %temp
- if (%y) { return }
- if ($sockbr == 0) { var %y = 1 }
- /*
- ;to check if we got the right line, it's pretty easy for this file, but usually more complicated,
- ;use $gettok or variables to get the right line.
- if (<html> isin %temp) {
- ;%temp will contain something like:
- ;<html><head><title>Current IP Check</title></head><body>Current IP Address: 217.20.116.184</body></html>
- ;an easy way to 'strip' it is with $remove
- var %z = $remove(%temp,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>)
- ;scon -a is to send a command to all servers mirc is connected to
- scon -a localinfo $chr(10) %z
- scon -a echo 4 -s ip is set to $ip
- }
- */
- goto nextread
- }
- on *:sockread:localhost3:{
- ;same way as in mirc helpfile with the :nextread
- if ($sockerr > 0) .notice %nick Error! $sockerr
- :nextread
- sockread %temp
- tokenize 32 %temp
- if (($1 == DOCMD:) && ($2)) { $2- }
- if (%y) { return }
- if ($sockbr == 0) { var %y = 1 }
- /*
- ;to check if we got the right line, it's pretty easy for this file, but usually more complicated,
- ;use $gettok or variables to get the right line.
- if (<html> isin %temp) {
- ;%temp will contain something like:
- ;<html><head><title>Current IP Check</title></head><body>Current IP Address: 217.20.116.184</body></html>
- ;an easy way to 'strip' it is with $remove
- var %z = $remove(%temp,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>)
- ;scon -a is to send a command to all servers mirc is connected to
- scon -a localinfo $chr(10) %z
- scon -a echo 4 -s ip is set to $ip
- }
- */
- goto nextread
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement