egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

delete info from db and skip on dupe

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
heman
Voice


Joined: 30 Dec 2006
Posts: 13

PostPosted: Sat Dec 30, 2006 3:34 pm    Post subject: delete info from db and skip on dupe Reply with quote

Hi,

I have two questions, I hope someone can help me with it Very Happy

Me and my friends have a little channel, where we have a bot with a script that stores info of size and files of a release.
The script works, but the problem is if someone adds info of a release and few hours later, someone else adds the same info, it will be stored twice.

So im looking for a way, that when info is already stored of the release in the db, and someone whant to add it again, it will give someting like a announce as: Release info already stored, not adding this info.


Then my second question is I want to add a command that @ in the channel can do to delete the info in the db. Someting like !delete releasename and the whole line with that info will be deleted from the db.

Hope everyting is clear.

Here is the script i use:

Code:

### config
set infodb  "./infodb.txt"
set chan_(info) "#channel"
bind pub - !info echo:info

### announce style
set announce_(info)    {[ INFO ] -> #releasename# -::- #section# #file#}

### addinfo
proc echo:info { nick uhost handle chan arg } {
 global infodb chan_
  set rl [lindex $arg 0]
  if { $rl == "" } {
      putserv "privmsg $chan : Usage  :!info RELEASE SIZE FILE"; return 0 }
    set sz [lindex $arg 1]
    set fl [lindex $arg 2]
 echo:infoadd INFO $fl $sz $rl INFO $chan_(info) 1
}

### announce
proc echo:infoadd { stat fl sz rl stat chan_info save } {
 global infodb announce_
 if { $save == "1" } {
  set data [open $infodb a]
  puts $data "$stat $fl $sz $rl"
  close $data
  putlog "$stat $fl $sz $rl added"
 }
 if { $stat == "INFO" } { set announce $announce_(info) }
 regsub -- {#file#} $announce $fl announce
 regsub -- {#section#} $announce $sz announce
 regsub -- {#releasename#} $announce $rl announce
  putserv "PRIVMSG $chan_info :$announce"
}


Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber