!report snippet

By Bielie on Jul 12, 2011

This is a !report script. It saves the reports you make to an ini file and you can check your last reports by typing !myreport.

Usage:

YOU: !report lol lol lol lol lol lol
BOT: (13:35:08) Your report: lol lol lol lol lol lol has been saved!

YOU: !myreport
BOT: (13:35:45) Your last report was: lol lol lol lol lol lol. Saved on: Tue Jul 12 13:35:08 2011

You can use this as a notepad or for support measures.

on $*:TEXT:/^[!.](report|note)/Si:#:{

  ;;antiflood1 (Spam)
  if (%flood [ $+ [ $address($nick,2) ] ]) { halt }
  set -u3 %flood [ $+ [ $address($nick,2) ] ] $true

  ;;antiflood2 (Overusage)
  if (%flood1 [ $+ [ $address($nick,2) ] ]) { notice $nick $c1(Please wait:) $c2($duration($var($+(%,flood1,$address($nick,2)),1).secs)) $c1(before using this command again!) | halt }

  ;;Checks, to keep your ini files clean.
  if (!$2-) { notice $nick $c1(Please use the correct syntax:) $c2(!report <reportmsg>) | halt }
  if (!$7) { notice $nick $c1(Please use atleast) $c2(6) $c1(words for your report!) | halt }
  if ($51 != $null) { notice $nick $c1(You cant use more then) $c2(50) $c1(words for your report!) | halt }

  else { /report $nick $2- |  notice $nick $c1(Your report:) 3" $+ $c2($2-) $+ 3" $c1(has been saved!) | set -u150 %flood1 [ $+ [ $address($nick,2) ] ] $true | halt }
}

;;To check your last report!
on $*:TEXT:/^[!.](myreport|mynote|lastreport)/Si:#:{

  ;;antiflood1 (Spam)
  if (%flood [ $+ [ $address($nick,2) ] ]) { halt }
  set -u3 %flood [ $+ [ $address($nick,2) ] ] $true

  if (!$2) {
    if (!$readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) { notice $nick $c1(You haven't report anything!) | halt }
    else { notice $nick $c1(Your last report was:) $c2($readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick [ $+ [ $nick ] ])) $+ .) $c1(Saved on:) $c2($readini(report.ini,n,$+(Dates,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) 3( $+ $c1(You have) $c2($ini(report.ini,$+(Dates,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) $c1(report(s)!)) $+ 3) | .timer 1 2 notice $nick $c1(You can check your other reports by typing:) $c2(!myreport <report number>) | halt }
  }
  if (!$readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) { notice $nick $c1(You haven't report anything!) | halt }
  else { notice $nick $c1(Checking for reports on spot) $c2( $+ $2 $+ ) $+ $c1(! Please wait.......) | .timer 1 4 notice $nick $iif($readini(report.ini,n,$+(Reports,$nick),$+($nick,$2)),$c1(Your) $c2($ord($2)) $c1(report is:) $c2($readini(report.ini,n,$+(Reports,$nick),$+($nick,$2))) $c1(Saved on:) $c2($readini(report.ini,n,$+(Dates,$nick),$+($nick,$2))) $c3($chr(60)) $+ $c3($chr(60)) $+ $c1(You have) $c2($ini(report.ini,$+(Dates,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) $c1(report(s)!) $c1(With a total of:) $c2($iif(%removednotes [ $+ [ $nick ] ],$v1,0) $c1(note(s) removed!)) $+ $c3($chr(62)) ,$c1(Nothing found on spot) $c2( $+  $+ $2 $+  $+ ) $+ $c1(.) $c3($chr(60)) $+ $c1(You have) $c2($ini(report.ini,$+(Dates,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) $c1(report(s)! With) $c2($iif(%removednotes [ $+ [ $nick ] ],$v1,0) $c1(note(s) removed!)))) $+ $c3($chr(62)) | halt }
}

;;To delete your report(s)!
on $*:TEXT:/^[!.](delreport|delnote)/Si:#:{

  ;;antiflood1 (Spam)
  if (%flood [ $+ [ $address($nick,2) ] ]) { halt }
  set -u3 %flood [ $+ [ $address($nick,2) ] ] $true

  var %getnick = $calc(%rnick [ $+ [ $nick ] ]) - 1)

  if (!$2) {

    if (!$readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) { notice $nick $c1(You haven't report anything!) | halt }

    else { notice $nick $c1(Deleting your last note! Please wait......) | remini report.ini $+(Dates,$nick) $+($nick,%rnick [ $+ [ $nick ] ]) | remini report.ini $+(reports,$nick) $+($nick,%rnick [ $+ [ $nick ] ]) | dec %rnick [ $+ [ $nick ] ] 1 | .timer 1 3 notice $nick $c1(Your last written note has been removed!) $c1(You now have a total of:) $c2($iif(%removednotes [ $+ [ $nick ] ],$v1,0) $c1(note(s) removed!)) | halt }
  }

  if ($2 == all) { notice $nick $c1(Deleting all your notes! Please wait......) | remini report.ini $+(reports,$nick) | remini report.ini $+(Dates,$nick) | unset %rnick [ $+ [ $nick ] ] | unset %removednotes [ $+ [ $nick ] ] | .timer 1 3 notice $nick $c1(All notes deleted! You now have a total of:) $c2($iif(%removednotes [ $+ [ $nick ] ],$v1,0) $c1(note(s) removed!)) | halt }

  elseif (!$3) { 

    if (!$readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick [ $+ [ $nick ] ]))) { notice $nick $c1(You haven't report anything!) | halt }

    if (!$readini(report.ini,n,$+(Reports,$nick),$+($nick,%rnick,$2))) { notice $nick $c1(You haven't report anything on spot) $c2($2) $+ $c1(!) | halt }

    notice $nick $c1(Deleting your) $c2($ord($2)) $c1(note! Please wait......) | remini report.ini $+(reports,$nick) $+($nick,%rnick,$2) | remini report.ini $+(Dates,$nick) $+($nick,%rnick,$2) | .timer 1 4 notice $nick $c1(Your) $c2($ord($2)) $c1(report has been removed!) $c1(You now have a total of:) $c2($iif(%removednotes [ $+ [ $nick ] ],$v1,0) $c1(note(s) removed!)) | writeini -n report.ini $+(Reports,$nick) $+($nick,%rnick,$2) Removed |  writeini -n report.ini $+(Dates,$nick) $+($nick,%rnick,$2) Removed | inc %removednotes [ $+ [ $nick ] ] 1
  }

  else { notice $nick $c1(No reports have been removed because you did something wrong! You typed:) $c2($1-) | halt }
}

;;Color alias that can be used with the ini file. You could build a script around it if you like ;)
alias c1 return $+($chr(3),$iif($readini(botinfo.ini,n,defcolor,$address($nick,3)),$v1,14),$1-,$chr(3))
alias c2 return $+($chr(3),$iif($readini(botinfo.ini,n,defcolor2,$address($nick,3)),$v1,06),$1-,$chr(3))
alias c3 return $+($chr(3),$iif($readini(botinfo.ini,n,defcolor3,$address($nick,3)),$v1,03), $+ $1- $+ ,$chr(3))

Comments

Sign in to comment.
Claus999   -  Aug 17, 2011

funny thing. i made a report. then i did !myreport and it said " You haven't report anything!"

 Respond  
Bielie   -  Jul 19, 2011

I kinda had to change the message into deleted because otherwise the countings werent correct anymore. Too bad i started with the wrong idea;s

 Respond  
PyThOn   -  Jul 15, 2011

k nice. Now i will actually try it out. :p

 Respond  
Bielie   -  Jul 15, 2011

Added !delnote function. Updated some bugs i found later :D

 Respond  
Bielie   -  Jul 14, 2011

i guess i could do that :P

updated

 Respond  
PyThOn   -  Jul 14, 2011

You should come up with a delreport command

 Respond  
Bielie   -  Jul 14, 2011

Solved everything to work perfect. The codes of the message are kind off messy but it works fine after 200 tests :P

 Respond  
PuNkTuReD   -  Jul 13, 2011

correct me if i am wrong...

inc %rnick [ $+ [ $1 ] ] 1
keeps track of how many reports are made by each person...

set %report [ $+ [ $+($1,%rnick) ] ]
has insufficent set parameters, but i believe was supposed to keep track of each reported report...

instead of using an ini like
[report]
punktured1=hi
punktured2=bye

etc

maybe a topic for each nick would be better... then you can use $ini to retireve the total number instead of a var...
plus have all reports stored correctly as you already do...

you told Dani_l11 to read the whole code...
but i still fail to see where you reference %report [ $+ [ $+($1,%rnick) ] ]
again after "setting" it...

 Respond  
Bielie   -  Jul 13, 2011

Yeah i kinda did ;) And my dedication to fix it took me into a train of creativity :D

 Respond  
PyThOn   -  Jul 12, 2011

Did you get your idea from TochA1551?

 Respond  
Bielie   -  Jul 12, 2011

Check the whole snippet to see what its for dani ;)

 Respond  
Dani_l11   -  Jul 12, 2011

set %report [ $+ [ $+($1,%rnick) ] ]

It doesn't have any data which sets to that var?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.