<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/21017" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2021-08-02T08:25:38-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/21017</id>

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-08-02T08:25:38-04:00</updated>

		<published>2021-08-02T08:25:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110156#p110156</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110156#p110156"/>
		<title type="html"><![CDATA[Reports Users]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110156#p110156"><![CDATA[
I did this little script:<div class="codebox"><p>Code: </p><pre><code>set report(file) "report.txt"set report(us.thanks) "Your report has been received. (Thanks)."set report(de.thanks) "Ihr Bericht wurde erhalten. (Vielen Dank)."set report(es.thanks) "Se ha recibido su reporte. (Gracias)."bind pub -|- !report report# main procedure: controler for actionsproc report {nick uhost handle chan text} {if {[llength [split $text]] == 0 } {report::error $nick $chanreturn 0}switch [join [lindex [split $text] 0]] {list {if {![report:hasrights $nick $chan $handle]} { return 0 }report:list $nick $uhost $handle $chan $textdel {if {![report:hasrights $nick $chan $handle]} { return 0 }report:del $nick $uhost $handle $chan $text}default {report:save $nick $uhost $chan $text}}# Check if user can list/delproc report:hasrights {nick chan handle} {if {($handle == "*") || ![matchattr $handle +n]} {report:error $nick $chanreturn 0} else {return 1}}# Send generic error messageproc report:error {nick chan} {putserv "PRIVMSG $chan :\002HOUSTON!\002 We've had a problem"}# Saves a reportproc report:save {nick uhost chan text} {if {[llength [split $text]] &lt; 2 } {putserv "PRIVMSG $nick :\002ERROR!\002 Enter a bot and info to report. Format: \002!report &lt;user&gt; &lt;description&gt;\002"return 0}set date [strftime %d/%m/%y]set fo [open $::report(file) a]set vbot [join [lindex [split $text] 0]]set desc [join [lrange [split $text] 1 end]]report:save $nick $uhost $chan $vbot $descputhelp "PRIVMSG $nick :$::report(us.thanks)"puthelp "PRIVMSG $nick :$::report(de.thanks)"puthelp "PRIVMSG $nick :$::report(es.thanks)"puts $fo "\[$date\] &lt;$nick@$uhost&gt; on $chan reported $vbot :$desc"close $fo}# Checks if report file exists and is not emptyproc report:getfile {nick} {if {![file exists $::report(file)]} {putserv "PRIVMSG $nick :No report"return 0}set fi [open $::report(file) r]set lines [read -nonewline $fi]if {$lines == ""} {putserv "PRIVMSG $nick :No report"return 0}close $fireturn $lines}# list content of report file to userproc report:list {nick uhost handle chan text} {if {![report:hasrights $nick $chan $handle]} { return 0 }set lines report:getfile $nickif {$lines == 0} { return 0 }set cpt 0foreach line [split $lines "\n"] {incr cptputserv "PRIVMSG $nick :#$cpt $line"}}# delete a line in the report fileproc report:del {nick uhost handle chan text} {if {![report:hasrights $nick $chan $handle]} { return 0 }set args [split $text]if {[llength $args]!=2 || [join [lindex $args] 0]!="del"} {report:error $nick $chanreturn 0}set ln [join [lindex $args 1]]if {![string is integer -strict $ln]} {report:error $nick $chanreturn 0}set fo [open ${::report(file).tmp} w]set lines report:getfile $nickif {$lines == 0} { return 0 }set cpt 0foreach line [split $lines "\n"] {incr cptif {$cpt == $ln} { continue }puts $fo $line}close $fofile rename -force -- ${::report(file).tmp} $::report(file)}putlog "************************************"putlog "* REPORT ***** LOADED ***** REPORT *"putlog "************************************" </code></pre></div>It can seem complex because I separated functionalities to allow their reuse.<br><br>Note that I don't check if the reported user exists on chan, and I double-check if user is allowed to list/del reports (check in controler and in dedicated proc).<br>This is to allow to add binds to directly run proc, like <strong class="text-strong">bind pub n !rdel report:del</strong><br><br>I didn't test the script, just made it on the fly <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon Aug 02, 2021 8:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ORATEGOD]]></name></author>
		<updated>2021-07-28T16:51:52-04:00</updated>

		<published>2021-07-28T16:51:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110143#p110143</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110143#p110143"/>
		<title type="html"><![CDATA[Reports Users]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110143#p110143"><![CDATA[
Greetings friends ... I was testing this TCL to inform users ...<br><br>But I don't know how to end ...<br><br><strong class="text-strong">As always I thank you for all your help.<br></strong><br><br><strong class="text-strong">public command</strong><br><br>ORATEGOD:<span style="color:red"><strong class="text-strong"> !report</strong></span><br>Bot: ERROR! Enter a bot and info to report. Format: !report &lt;user&gt; &lt;description&gt; <br><br>ORATEGOD: <span style="color:red"><strong class="text-strong">!report &lt;user&gt; &lt;description&gt;</strong></span><br>Bot: ORATEGOD: Your report has been received. (Thanks)..<br>Bot: ORATEGOD: Ihr Bericht wurde erhalten. (Vielen Dank)..<br>Bot: ORATEGOD: Se ha recibido su informe. (Gracias)..<br><br><strong class="text-strong">command for bot owner</strong><br><br><span style="color:red"><strong class="text-strong">!report list</strong></span> (<em class="text-italics">shows list of reports (if there are any</em>)<br>Bot: 1. <strong class="text-strong">user1</strong> description of the problem.<br>Bot: 2. <strong class="text-strong">user2</strong> description of the problem.<br>Bot: 3. <strong class="text-strong">user3</strong> description of the problem.<br>Bot: 4. <strong class="text-strong">user4</strong> description of the problem.<br><br><span style="color:red"><strong class="text-strong">!report del</strong></span><br>Bot: Houston, we have a problem<br><br><span style="color:red"><strong class="text-strong">!report del 3</strong></span><br>Bot: report number 3 has been deleted<blockquote class="uncited"><div>set report(file) "report.txt"<br>set report(us.thanks) "Your report has been received. (Thanks)."<br>set report(de.thanks) "Ihr Bericht wurde erhalten. (Vielen Dank)."<br>set report(es.thanks) "Se ha recibido su reporte. (Gracias)."<br><br>bind pub -|- !report report:tofile<br><br>proc report:tofile {nk uh hn ch tx} {<br> global report<br> set date [strftime %d/%m/%y] <br> set open [open $report(file) a]<br> puts $open "- $nk reported: $tx"<br> close $open<br> puthelp "PRIVMSG $ch :${nk}: $report(us.thanks)."<br> puthelp "PRIVMSG $ch :${nk}: $report(de.thanks)."<br> puthelp "PRIVMSG $ch :${nk}: $report(es.thanks)."<br>}<br><br>putlog "************************************"<br>putlog "* REPORT ***** LOADED ***** REPORT *"<br>putlog "************************************"</div></blockquote>Sorry my bad english (:<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12869">ORATEGOD</a> — Wed Jul 28, 2021 4:51 pm</p><hr />
]]></content>
	</entry>
	</feed>
