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 

On message[solved]
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Fri Jul 20, 2012 11:05 am    Post subject: On message[solved] Reply with quote

Hey

Could someone do the following I am looking for an on message script that will do the following when my tweeter bot shows a message from Severe Warnings my weather bot will send a tweet

This is the message on channel

<Tweeter> Severe Warnings: Severe Thunderstorm Warning for St. Louis County in MN until 10:30am CDT. #mnwx ( 226329880487403520@severewarn - 58s ago via ReadyWarn )

I want my weather bot to beable to tweet just this part of that tweet

Severe Thunderstorm Warning for St. Louis County in MN until 10:30am CDT. #mnwx

it should ignore Severe Warnings: and ( 226329880487403520@severewarn - 58s ago via ReadyWarn ) part of the message

I am using speechless burdy to send the tweet so it would send this to the channel on message

!tweet Severe Thunderstorm Warning for St. Louis County in MN until 10:30am CDT. #mnwx

obviously it wont be that everytime and sometimes Severe Thunderstorm Warning might also be Severe Tornado watch/warning

Thanks in advance
_________________
Blake
UKEasyHosting UKStormWatch


Last edited by blake on Sun Jul 29, 2012 10:25 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 1:59 pm    Post subject: Reply with quote

I have tried the following code but its not doing anything its not even showing errors any one got any ideas how to do this

Code:

bind msg - "*" user:message

proc user:message {nick uhost handle text dest} {
  set text [stripcodes bcruag $text]
  if {[string equal -nocase "tweeter" $nick] && [string match -nocase "severe warnings:*" $text]} {
    putserv "PRIVMSG #Twitter : !tweet : [string trim [join [lrange [split $text {:}] 1 end]]]"
  }   
}


I know this will only strip the text severe warnings so if any one has any idea how to get this working and also strip ( 226329880487403520@severewarn - 58s ago via ReadyWarn ) id be great full
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 2:23 pm    Post subject: Reply with quote

When using the msg binding, the proc is called with four parameters (nickname, user@host, handle, and text) - your proc expects a fifth parameter (dest). You'll have to remove that fifth one (or provide a default value for it) for it to work with your binding.

As for the more advanced parts of your request, I'd probably use regular expression matching rather than glob-based matching (string match):
Code:
bind msg - "*" user:message
proc user:message {nick host handle text} {
  set text [stripcodes bcruag $text]
  if {[regexp -- {Severe Warnings: ([[:alnum:][:space:][:punct:]]*?) \( ?[[:digit:]]+@severewarn.* ?\)} $text match warning]} {
    puthelp "PRIVMSG #Twitter :!tweet : $warning"
  }
}


Might have to tune the pattern depening on permitted contents of the messages.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 3:32 pm    Post subject: Reply with quote

Hey

I have tried that it is not doing anything at all could it be because this part is in bold Severe Warnings

this is the output

<+Tweeter> Severe Warnings: Severe Thunderstorm Warning for Johnston, Sampson, and Wayne County in NC until 4:45pm EDT. #ncwx ( 226763682313539584@severewarn - 11s ago via ReadyWarn )
_________________
Blake
UKEasyHosting UKStormWatch


Last edited by blake on Sat Jul 21, 2012 3:44 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 3:42 pm    Post subject: Reply with quote

Control-codes such as bold would be stripped using the stripcodes command.
I've successfully tested the regexp pattern against the string you posted.
One thing that strikes me now though, is that you are using a msg binding, not an msgm binding. You can't use wildcards with msg bindings, and the "command" part is only matched against the first word spoken. You'll need msgm instead.

Code:
bind msgm - "Severe Warnings:*" user:message
proc user:message {nick host handle text} {
  set text [stripcodes bcruag $text]
  set pattern {Severe Warnings: ([[:alnum:][:space:][:punct:]]*?) \( ?[[:digit:]]+@severewarn.* ?\)}
  if {[string equal -nocase $nick "tweeter"] && [regexp -- $pattern $text match warning]} {
    puthelp "PRIVMSG #Twitter :!tweet : $warning"
  }
}

_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Sat Jul 21, 2012 4:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 3:59 pm    Post subject: Reply with quote

Tried this its stll not sending any out put to the channel showing no errors
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 4:01 pm    Post subject: Reply with quote

Minor typo in my last post, fixed now.
(used "Severe Warning:" instead of "Severe Warnings:" in the binding)
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 4:19 pm    Post subject: Reply with quote

That hasnt made any difference

it still isnt outputting anything to the channel when it sees

<+Tweeter> Severe Warnings: Severe Thunderstorm Warning for Johnston, Sampson, and Wayne County in NC until 4:45pm EDT. #ncwx ( 226763682313539584@severewarn - 11s ago via ReadyWarn )

this is also on the channel #twitter its not being sent via private message its a channel message
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 4:24 pm    Post subject: Reply with quote

Well, if it's sent to a channel, you need the pubm binding, not the msg or msgm bindings... Which also means that the proc has to be modified to take the new set of parameters.

Code:
bind pubm - "% Severe Warnings:*" user:message
proc user:message {nick host handle channel text} {
  set text [stripcodes bcruag $text]
  set pattern {Severe Warnings: ([[:alnum:][:space:][:punct:]]*?) \( ?[[:digit:]]+@severewarn.* ?\)}
  if {[string equal -nocase $nick "tweeter"] && [regexp -- $pattern $text match warning]} {
    puthelp "PRIVMSG #Twitter :!tweet : $warning"
  }
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 4:56 pm    Post subject: Reply with quote

Hey

Sorry nml375 but that dont seem to be working either thanks for your help though
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 4:59 pm    Post subject: Reply with quote

I roughly recall channel text being stripped of any control characters prior being matched, but just in case I'm wrong; try replacing the mask in the binding with just "*"
(bind pubm - "*" user:message)
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 5:17 pm    Post subject: Reply with quote

That has not worked Smile
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 21, 2012 6:00 pm    Post subject: Reply with quote

Hard to say then. I assume "Tweeter" is a different eggdrop than the one running this script.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Sat Jul 21, 2012 6:12 pm    Post subject: Reply with quote

They are both the same the tweeter eggdrop is running speechless burdy script both eggdrops are eggdrop v1.6.20
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


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

PostPosted: Sat Jul 21, 2012 9:38 pm    Post subject: Reply with quote

Code:
            if {![isbotnick $nick]} {
               if {![info exists skip]} {
                  putserv "$to :$tt" ; set sp 0
               }
            } else {
               if {[string equal -nocase "friends" $type]} {
                  if {($twitter($tuser,lastidf) < $id && ![string equal -nocase $screen $tuser]) || ($twitter($tuser,lastidf) == $id && [info exists sp] && ![string equal -nocase $screen $tuser])} {
                     if {![info exists skip]} {
                        # ---> code added starts here - automations should retweet
                        # is the user that just tweeted the one we want?
                        if {[string equal -nocase "severewarn" $screen]]} {
                           # yes - set query with id to retweet
                           set q [list [list id $id]]
                           # map url with id of tweet to retweet
                           set rt [string map [list "%id%" "$id"] $twitter(retweet)]
                           # issue retweet - silently
                           if {[catch {set rtt [proc:twitter:oauth $rt POST $chan $q]} error]} { putlog "$twitter(logo) Auto-Retweet: $error" }
                        }
                        # <--- code added ends here
                        putserv "$to :$tt" ; set sp 0
                     }
                     if {![info exists pure]} {
                        set twitter($tuser,lastidf) $id
                        set pure 0
                     }
                  }
               } else {


You can do this all within birdy itself by a slight hack. This will allow it to detect when its running its friends automation, and during the initial spew of this check if it should "retweet" the message if it matches your pattern. Hopefully you can understand the code above enough to understand how to hack it in. The procedure you want to do this in is called, proc:twitter:restapi. This is more natural, a retweet of something like this, than taking the tweet and claiming it for your own. Consider this a more ethical approach to what you want to do.

Note: This requires you have issued .. +follow severewarn .. and they have not blocked you, this will then retweet every single one of their tweets into your own timeline. If you want it more refined or something, let me know. ;D
_________________
speechles' eggdrop tcl archive
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 -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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