update
This commit is contained in:
parent
503957970d
commit
5e890658a8
2 changed files with 7 additions and 1 deletions
BIN
boddle.db
BIN
boddle.db
Binary file not shown.
|
|
@ -214,6 +214,8 @@ func parsemsg(msg irc_msg, foo bot) bool {
|
|||
if (len(c.suffix) <= 0) {
|
||||
return false;
|
||||
}
|
||||
c.suffix = strings.Replace(c.suffix,"\"","'", -1)
|
||||
fmt.Printf(c.suffix)
|
||||
// insert into database
|
||||
statement, err := db.Prepare("insert into line (content, author) values (?,?)")
|
||||
checkErr(err)
|
||||
|
|
@ -222,7 +224,8 @@ func parsemsg(msg irc_msg, foo bot) bool {
|
|||
defer statement.Close()
|
||||
|
||||
// get ID of content...
|
||||
task := fmt.Sprintf("select l.id from line l where l.content = \"%s\"", strings.Replace(c.suffix, "'", "''", -1))
|
||||
task := fmt.Sprintf("select l.id from line l where l.content = \"%s\"", c.suffix) // strings.Replace(c.suffix, "'", "''", -1))
|
||||
fmt.Printf(task)
|
||||
row, err := db.Query(task)
|
||||
checkErr(err)
|
||||
line_id := 0
|
||||
|
|
@ -231,6 +234,7 @@ func parsemsg(msg irc_msg, foo bot) bool {
|
|||
LOG_INFO.Printf(c.cmd)
|
||||
if line_id == 0 {
|
||||
LOG_WARN.Printf("no entry for adding")
|
||||
sendmsg(foo.conn, msg.channel, "internal server error.")
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -252,6 +256,8 @@ func parsemsg(msg irc_msg, foo bot) bool {
|
|||
LOG_INFO.Printf("inserted foo! \n")
|
||||
defer stat.Close()
|
||||
}
|
||||
sendmsg(foo.conn, msg.channel, fmt.Sprintf("success adding new super funny enjoyable line with ID %d!", line_id))
|
||||
sendmsg(foo.conn, "horscchtey", fmt.Sprintf("new line: > %s < (ID %d)", c.suffix, line_id))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue