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 

Ramdom quote from fmylife.com
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Mar 21, 2009 11:49 am    Post subject: Reply with quote

Sydneybabe wrote:
Good day tomekk, can i request if these word FML on last part of the sentence at http://www.fmylife.com/ quotes can trim or hide so that it will not appear on channel trigger.. example like this:

Today, I got a letter from the Navy saying that they accepted my application to join the Navy. I never applied. FML

.. the bold one at the end.. thanks in advance Very Happy

The easiest way to do it is exactly as you've said it, "can trim". So that's how this approach takes it.
Code:
change from: putquick "PRIVMSG $chan :$fm_quote"
change into: putquick "PRIVMSG $chan :[string trimright $fm_quote "FML"]"

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Sydneybabe
Op


Joined: 27 Apr 2007
Posts: 106
Location: Philippines

PostPosted: Tue Mar 24, 2009 7:55 am    Post subject: Reply with quote

thanks a lot speechless Smile i change the link into http://www.randomquotes.info/ but the bot on channel says - some problem with data, try again later, sorry. how this random webite quotes work.. thanks a lot in advance for the help Very Happy
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Mar 25, 2009 2:11 pm    Post subject: Reply with quote

Sydneybabe wrote:
thanks a lot speechless Smile i change the link into http://www.randomquotes.info/ but the bot on channel says - some problem with data, try again later, sorry. how this random webite quotes work.. thanks a lot in advance for the help Very Happy


its normal, this script works only for http://www.fmylife.com/random

@Globulus
"Pulls a random quote from http://www.fmylife.com/. Initial release by Tomekk modified to fix cooldown that is not working."

thanks for pro advertisement ;-P
You could insert a link to this topic Wink

cheers
Back to top
View user's profile Send private message Visit poster's website
addaitech
Voice


Joined: 17 Jun 2009
Posts: 4

PostPosted: Wed Jun 17, 2009 9:49 am    Post subject: Reply with quote

any idea as to why the script will only show the url of the quote and not the quote itself??

!09:48:20! (lennox\) !fml
!09:48:22! <morphix> --| http://www.fmylife.com/miscellaneous/1363713
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Jun 17, 2009 10:15 am    Post subject: Reply with quote

the source code of fmylife has changed Wink
Back to top
View user's profile Send private message Visit poster's website
addaitech
Voice


Joined: 17 Jun 2009
Posts: 4

PostPosted: Wed Jun 17, 2009 10:34 am    Post subject: Reply with quote

tomekk wrote:
the source code of fmylife has changed Wink

any idea on how i change the script to work again?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Jun 17, 2009 11:07 am    Post subject: Reply with quote

You have to look into fmylife page source code and fix the regexps in TCL script.
I can't fix that because if i do this, i will stuck with this script to end of my days.

I hate scripts based on parsing web source code, it was my last.

cheers !
Back to top
View user's profile Send private message Visit poster's website
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Wed Jun 17, 2009 12:07 pm    Post subject: Reply with quote

What mean \1 in
Code:
# 1st quote
   regsub -nocase {.*<div\s+class=\"post\"><p>(.+)</p><div\s+class=\"date\"\s+style=\"float:left;\">.*} $fm_data {\1} fm_data

If we use regsub it mean we change
Code:
.*<div\s+class=\"post\"><p>(.+)</p><div\s+class=\"date\"\s+style=\"float:left;\">.*
to \1 or Im wrong?
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Jun 17, 2009 12:36 pm    Post subject: Reply with quote

simple example:

string: <mark> something here lala </mark>

Code:
#!/usr/bin/tclsh

set mystr "<mark> something here lala </mark>"

regsub {<mark>(.+)<\/mark>} $mystr {\1} mystr

puts $mystr


output:
Quote:
[tomekk@zonk]:/home# ./zonk.tcl
something here lala


its all based on simple regular expressions and regexp 'groups', there is many info about this in the internet

bye
Back to top
View user's profile Send private message Visit poster's website
wac
Halfop


Joined: 10 Dec 2006
Posts: 80
Location: in my cardboard box

PostPosted: Wed Jun 17, 2009 1:33 pm    Post subject: Reply with quote

I'd do it if I knew how but since I don't so I can't, shame the only person that currently does won't help. Crying or Very sad
_________________
I see j00!
Back to top
View user's profile Send private message
addaitech
Voice


Joined: 17 Jun 2009
Posts: 4

PostPosted: Wed Jun 17, 2009 1:54 pm    Post subject: Reply with quote

wac wrote:
I'd do it if I knew how but since I don't so I can't, shame the only person that currently does won't help. Crying or Very sad

I dont know how to do it either.
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Wed Jun 17, 2009 4:59 pm    Post subject: Reply with quote

Take it.

Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.3
#
# New html tag by username@forum.egghelp.org
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# channels for !fmylife
set fmylife_channels {#egghelp #erotic}

# time between use !fmylife (seconds)
set fmylife_reuse_time 20

# auto query
# 0 - off, 1 - on
set fmylife_auto_query 0

# set auto query interval (minutes)
set fmylife_auto_interval 10

###########################################################
bind pub - !fmylife fm_main_proc

package require http

proc get_fmylife { } {
   set f_http_uagent "Opera/9.61 (Windows i686; U; en) Presto/2.1.1"
   set f_http_token [http::config -useragent $f_http_uagent]
   if {[catch {set f_http_token [::http::geturl "http://www.fmylife.com/random" -timeout 15000]}]} {
      return "error"
   } {
      return [http::data $f_http_token]
   }
}

set fmylife_reuse 1

proc fmylife_timer { } {
   global fmylife_auto_interval
   fm_auto_proc

   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

proc fm_auto_proc { } {
   global fmylife_channels

   set fm_quote ""
        set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putlog "auto-quote-fmylife: problem with connection"
      return
   }

   foreach fm_each_chan [split $fmylife_channels] {
      if {$fm_each_chan != ""} {
         set fm_each_chan [string trim $fm_each_chan]

         if {[botonchan $fm_each_chan]} {
             fmylife_print $fm_quote $fm_each_chan
         }
      }
   }
}

proc fm_main_proc { nick uhost hand chan arg } {
   global fmylife_channels fmylife_reuse fmylife_reuse_time

   if {[expr [clock seconds] - $fmylife_reuse] <= $fmylife_reuse_time} {
      putquick "PRIVMSG $chan :$nick: to fast, sorry"
      return
   }

   if {[lsearch $fmylife_channels $chan] == -1} {
      return
   }

   set fm_quote ""
   set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putquick "PRIVMSG $chan :problem with connection, try again later, sorry"
      return
        }

   fmylife_print $fm_quote $chan
}

proc fmylife_print { fm_data fm_chan } {
   global fmylife_reuse

   set fm_link ""

   regsub -all -nocase "\n" $fm_data "" fm_data
   regsub -all -nocase "\r" $fm_data "" fm_data
   regsub -all -nocase "\t" $fm_data "" fm_data

   # 1st quote
   regsub -nocase {.*<div\s+class=\"clear\"><\/div><\/div>(.+)<div\s+class=\"more\">.*} $fm_data {\1} fm_data

   # 1st link
   regsub -nocase {.*<a\s+href=\"([a-z0-9\/ ]+)\"\s+class="fmllink">.*} $fm_data {\1} fm_link

   # del rest of links from quote
   regsub -all -nocase {<a\s+href=\"[a-z0-9\/ ]+\"\s+class=\"fmllink\">} $fm_data "" fm_data

   # voting result
   regsub -nocase {.*f\*\*\*ed<\/a>\s+(.+)<\/span>\s+-.*} $fm_data {\1} fm_fckd
   regsub -nocase {.*one<\/a>\s+(.+)<\/span>.*} $fm_data {\1} fm_dsrv

   # date and name
   regsub -nocase {.*<p\s+style=\"margin-top\:2px\;\">(.+)\s+-\s+<a\s+class=\"liencat\".*} $fm_data {\1} fm_date
   regsub -nocase {.*<a\s+class=\"liencat\"\s+href="/[a-z0-9\/ ]+\">[a-z0-9\/ ]+<\/a>\s+-\s+by\s+(.*?)\s+-\s+<a\s+href=\"\/country\/.*} $fm_data {\1} fm_name
   regsub -all -nocase {<a href="/gender/woman" class="light">} $fm_name "" fm_name
   regsub -all -nocase {<a href="/gender/man" class="light">} $fm_name "" fm_name
   regsub -all -nocase {</a>} $fm_name "" fm_name

   # fml text
   regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

   # the rest of useless tags
   regsub -all -nocase "<\/a>" $fm_data "" fm_data
   regsub -all -nocase "<\/p>" $fm_data "" fm_data
   regsub -all -nocase "<\/div>" $fm_data "" fm_data

   set fm_link "http://www.fmylife.com$fm_link"

   if {[regexp -nocase {http:\/\/www\.fmylife\.com[a-z0-9\/ ]+} $fm_link]} {
      putquick "PRIVMSG $fm_chan :\00310$fm_data"
      putquick "PRIVMSG $fm_chan :\00314I agree, your life is f***ed \00303$fm_fckd \00314- you deserved that one \00303$fm_dsrv\00314. Added \00303$fm_date \00314by $fm_name\00303."
      putquick "PRIVMSG $fm_chan :\00304--| \00312\037$fm_link\037\003"
      set fmylife_reuse [clock seconds]
   } {
      putquick "PRIVMSG $fm_chan :some problem with data, try again later, sorry"
   }
}

if {$fmylife_auto_query != 0} {
   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

putlog "fmylife-quote.tcl ver 0.2 by tomekk loaded"


Quote:
[00:58:38] <@tvrsh> !fmylife
[00:58:53] <@bionic> Today, a boy I'm not even dating took it upon himself to tell me that we would never work out. Via text message. FML
[00:58:53] <@bionic> I agree, your life is f***ed (11593) - you deserved that one (672). Added On 01/31/2009 at 11:52am by wowza.
[00:58:53] <@bionic> --| http://www.fmylife.com/love/4103

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
addaitech
Voice


Joined: 17 Jun 2009
Posts: 4

PostPosted: Wed Jun 17, 2009 5:22 pm    Post subject: Reply with quote

username wrote:
Take it.

Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.3
#
# New html tag by username@forum.egghelp.org
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# channels for !fmylife
set fmylife_channels {#egghelp #erotic}

# time between use !fmylife (seconds)
set fmylife_reuse_time 20

# auto query
# 0 - off, 1 - on
set fmylife_auto_query 0

# set auto query interval (minutes)
set fmylife_auto_interval 10

###########################################################
bind pub - !fmylife fm_main_proc

package require http

proc get_fmylife { } {
   set f_http_uagent "Opera/9.61 (Windows i686; U; en) Presto/2.1.1"
   set f_http_token [http::config -useragent $f_http_uagent]
   if {[catch {set f_http_token [::http::geturl "http://www.fmylife.com/random" -timeout 15000]}]} {
      return "error"
   } {
      return [http::data $f_http_token]
   }
}

set fmylife_reuse 1

proc fmylife_timer { } {
   global fmylife_auto_interval
   fm_auto_proc

   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

proc fm_auto_proc { } {
   global fmylife_channels

   set fm_quote ""
        set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putlog "auto-quote-fmylife: problem with connection"
      return
   }

   foreach fm_each_chan [split $fmylife_channels] {
      if {$fm_each_chan != ""} {
         set fm_each_chan [string trim $fm_each_chan]

         if {[botonchan $fm_each_chan]} {
             fmylife_print $fm_quote $fm_each_chan
         }
      }
   }
}

proc fm_main_proc { nick uhost hand chan arg } {
   global fmylife_channels fmylife_reuse fmylife_reuse_time

   if {[expr [clock seconds] - $fmylife_reuse] <= $fmylife_reuse_time} {
      putquick "PRIVMSG $chan :$nick: to fast, sorry"
      return
   }

   if {[lsearch $fmylife_channels $chan] == -1} {
      return
   }

   set fm_quote ""
   set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putquick "PRIVMSG $chan :problem with connection, try again later, sorry"
      return
        }

   fmylife_print $fm_quote $chan
}

proc fmylife_print { fm_data fm_chan } {
   global fmylife_reuse

   set fm_link ""

   regsub -all -nocase "\n" $fm_data "" fm_data
   regsub -all -nocase "\r" $fm_data "" fm_data
   regsub -all -nocase "\t" $fm_data "" fm_data

   # 1st quote
   regsub -nocase {.*<div\s+class=\"clear\"><\/div><\/div>(.+)<div\s+class=\"more\">.*} $fm_data {\1} fm_data

   # 1st link
   regsub -nocase {.*<a\s+href=\"([a-z0-9\/ ]+)\"\s+class="fmllink">.*} $fm_data {\1} fm_link

   # del rest of links from quote
   regsub -all -nocase {<a\s+href=\"[a-z0-9\/ ]+\"\s+class=\"fmllink\">} $fm_data "" fm_data

   # voting result
   regsub -nocase {.*f\*\*\*ed<\/a>\s+(.+)<\/span>\s+-.*} $fm_data {\1} fm_fckd
   regsub -nocase {.*one<\/a>\s+(.+)<\/span>.*} $fm_data {\1} fm_dsrv

   # date and name
   regsub -nocase {.*<p\s+style=\"margin-top\:2px\;\">(.+)\s+-\s+<a\s+class=\"liencat\".*} $fm_data {\1} fm_date
   regsub -nocase {.*<a\s+class=\"liencat\"\s+href="/[a-z0-9\/ ]+\">[a-z0-9\/ ]+<\/a>\s+-\s+by\s+(.*?)\s+-\s+<a\s+href=\"\/country\/.*} $fm_data {\1} fm_name
   regsub -all -nocase {<a href="/gender/woman" class="light">} $fm_name "" fm_name
   regsub -all -nocase {<a href="/gender/man" class="light">} $fm_name "" fm_name
   regsub -all -nocase {</a>} $fm_name "" fm_name

   # fml text
   regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

   # the rest of useless tags
   regsub -all -nocase "<\/a>" $fm_data "" fm_data
   regsub -all -nocase "<\/p>" $fm_data "" fm_data
   regsub -all -nocase "<\/div>" $fm_data "" fm_data

   set fm_link "http://www.fmylife.com$fm_link"

   if {[regexp -nocase {http:\/\/www\.fmylife\.com[a-z0-9\/ ]+} $fm_link]} {
      putquick "PRIVMSG $fm_chan :\00310$fm_data"
      putquick "PRIVMSG $fm_chan :\00314I agree, your life is f***ed \00303$fm_fckd \00314- you deserved that one \00303$fm_dsrv\00314. Added \00303$fm_date \00314by $fm_name\00303."
      putquick "PRIVMSG $fm_chan :\00304--| \00312\037$fm_link\037\003"
      set fmylife_reuse [clock seconds]
   } {
      putquick "PRIVMSG $fm_chan :some problem with data, try again later, sorry"
   }
}

if {$fmylife_auto_query != 0} {
   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

putlog "fmylife-quote.tcl ver 0.2 by tomekk loaded"


Quote:
[00:58:38] <@tvrsh> !fmylife
[00:58:53] <@bionic> Today, a boy I'm not even dating took it upon himself to tell me that we would never work out. Via text message. FML
[00:58:53] <@bionic> I agree, your life is f***ed (11593) - you deserved that one (672). Added On 01/31/2009 at 11:52am by wowza.
[00:58:53] <@bionic> --| http://www.fmylife.com/love/4103


Thanks alot, appreciate it.
Back to top
View user's profile Send private message
wac
Halfop


Joined: 10 Dec 2006
Posts: 80
Location: in my cardboard box

PostPosted: Wed Jun 17, 2009 7:11 pm    Post subject: Reply with quote

username wrote:
Take it.


Thanks, much appreciated!
_________________
I see j00!
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Thu Jun 18, 2009 2:26 am    Post subject: Reply with quote

I add wordwrap proc from user`s post http://forum.egghelp.org/viewtopic.php?p=81741#81741
Download new version here http://www.egghelp.ru/file.php?id=460
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 
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