As promised here is an enhanced, fully workable IRC client for twitter. This bridges twitter directly to IRC and allows IRC to bridge back to twitter. You create the bridge by issuing these commands:
Reply format when replying to a tweet:
!tweet @msg-id-here @username #mychan hits twitter! ;P
Tweet format when tweeting to a username:
!tweet @username #mychan just hit twitter ;P
Do not change the global-tweet-format from it's default value. Do not use a local-tweet-format within your account creation list. This is important to remember if you want your bot to correctly follow timelines and know its own messages, reply tweets, and mentions from those other users may have !tweet'd.
Whenever any twitter username @mentions your account name, every 10 minutes (default) your bot will check and display the most recent (2 by default) directly to IRC. These will be displayed with time-stamps, msg-id's, user-names, screen-names and the actual text. This allows you to reply if you want directly through IRC to them if you wish all in near-real-time. The megahal feature has been slightly toned down. It will no longer reply to RT's issued, and instead merely display these to IRC. It will skip messages that are tweets to its own account from it's own account. These are from users using the !tweet function and are meant to be part of the twitter account and therefore have already been displayed on IRC when the tweet was issued and aren't displayed again. It will skip its own @username mentions if these are from it's own account. This is because of the same thing as mentioned above these were already shown. Here is some action of the timeline display and auto-megahal reply in action
<sp33chy> [
Twitter]: (Megahal) @Mention: Sat Feb 13 22:07:32 +0000 2010 [9072011305]:<sp33chy of efnet@EFNet_sp33chy> @suqmuhnutz <DecoyOcto> steal your mom's purse as you leave <-- your a [censored] thief???!!!! call teh cops!!!!!
<sp33chy> [
Twitter]: (Megahal) sp33chy's reply tweet: RT @EFNet_sp33chy <sp33chy> No you is a gay cop i am doing invetory steal.
<sp33chy> [
Twitter]: (Megahal) @Mention: Sat Feb 13 18:04:24 +0000 2010 [9064548404]:<Epic Cyndaquil@EpicCyndaquil> @suqmuhnutz That's not nice
<sp33chy> [
Twitter]: (Megahal) sp33chy's reply tweet: RT @EpicCyndaquil <sp33chy> P e n p e r b e a r a m e w i t h a e l a d e e c h l e h e p r e f e r c o c k s.
To get the script to work at all in your channel after properly adding your accounts, you must: .chanset #yourchan +twitter
To enable the near-real-time mention tracking behavior, you need to: .chanset #yourchan +twittermentions
To (enable/disable) megahal replying to this, issue: .chanset #yourchan (+/-)twittermega
If you have meghal enabled for reply to tweets coming from @mentions it will then also, reply to others issuing tweets from your account. As long as these aren't RT or issued to @usernames. It looks like this on IRC.
<speechles> !tweet sp33chy yer like crazy n stuff :
P
<sp33chy> [
Twitter]: Tweet created: [9072963886] (#roms-isos@suqmuhnutz via API) Sat Feb 13 22:39:16 +0000 2010 @
http://twitter.com/suqmuhnutz
...~10 mins later...
<sp33chy> [
Twitter]: (Megahal) sp33chy replied to speechles's tweet. @
http://twitter.com/suqmuhnutz
To test out this experimental release, see below....
Twitter, Tweets with Megahal v4.2 (Egghelp version)
Here is what the config looks like for the script now:
Code: Select all
... snipped irrelevant parts ...
# Terms and Agreements of use
# ------
# You assume all rights, responsibility, and consequences
# which may arise from using this script. I as copyleft
# holder only assume right to title, it is the burden
# of copyleft title user to guarantee responsible use
# of this twitter application. Failure to do so may, or
# may not result in the suspension/deletion of your
# twitter account. Using this script signifies your reading
# of this, the copyleft statement below, and the disclaimer
# found directly below the copyleft statement... read on...
# ------
# Copyleft (C) 2010 - speechles (imspeechless@gmail.com)
# v4.2 - February 14th, 2010 -
# speechles (#roms-isos@efnet) *copyleft gnu v3
# ------
# Version 4.x Disclaimer: -- IMPORTANT: PLEASE READ --
# This is merely an experimental release to support irc channel
# banter as well as the presence of the artificial intelligence
# known as megahal onto twitter. This is not to be taken
# as some sort of tool of which to spam and cause havoc for
# twitter. This is to further our reach as irc users into
# the medium which a lot of users seem to be using today. But..
# using this script the format will stick to our standard irc
# look and feel. This allows irc users to reach out beyond their
# irc channels into a broader medium which may attract them a
# larger userbase. This was not designed as a tool to use to
# spam twitter. Yes, I repeated that and I may do so again
# shortly. Don't spam with this, be responsible. Now a bit about
# the config section. Make sure you've read it completely. Leaving
# the settings default leaves everything turned on. If you don't
# use megahal disable it in the script to assure it's off. If you
# have questions find the thread on egghelp and compose them
# as a post to that thread. This requires you make a username on
# that forum to do so which assures me you're not asking for
# your modifications to support some nefarious intent.
# ------
... snipped more irrelevant parts ...
# This is the twitter logo.
# (string)
set twitter(logo) "\[\002\00311Twitter\002\003]:"
# Set user agent.
# (string)
set twitter(agent) "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"
# Set the url base
# (string)
set twitter(url) "http://twitter.com/"
# Set the output style here:
# %chan == $chan, %nick == $nick
# no other variables can be used
# (string)
set twitter(output) "PRIVMSG %chan"
# What effect would you like added to twitter numerics?
# for example:
# effect on "\00304" is red text
# effect off "\003" turns off the color
# (strings)
set twitter(effect-on) "\002"
set twitter(effect-off) "\002"
# How many seconds should each user wait before re-issuing
# the same twitter command? Set this in seconds.
# (integer)
set twitter(throttle) 1
# If you have Trf or zlib packages detectable, this script
# will let you use gzip to speed up your twittering..
# Would you like to enable gzip auto-detection?
# (0 off/1 on)
set twitter(use_gzip) 1
# Url to issue tweets to - json is fine
# you should never need to change this.
# (string)
set twitter(tweet) "http://twitter.com/statuses/update.json"
set twitter(privatenew) "http://twitter.com/direct_messages/new.json"
set twitter(follow) "http://twitter.com/friendships/create.json"
# timelines - xml is far easier to parse...
# you should never need to change these either.
# (strings)
set twitter(friends) "http://www.twitter.com/statuses/friends_timeline.xml"
set twitter(public) "http://www.twitter.com/statuses/public_timeline.xml"
set twitter(user) "http://www.twitter.com/statuses/user_timeline.xml"
set twitter(home) "http://www.twitter.com/statuses/home_timeline.xml"
set twitter(mention) "http://www.twitter.com/statuses/mentions.xml"
set twitter(private) "http://twitter.com/direct_messages.xml"
# max amount of timelines to show in channel, this is how many
# lines you wish to see for every request.
# (integer, preferably less than 5 or 6 or it's spammy)
set twitter(friendmax) 4
# Set the global tweet format here
# if no local tweet format is set in the channel acct list below
# then the global setting will be used instead.
# %nick = $nick
# %chan = $chan
# %text = user input
# %modes = (+ or @) op or voice only presently...
# (string)
set twitter(globaltweetformat) "<%nick> %text"
# minimum flags required to issue tweets
# (string)
set twitter(flags) "vomn|vomn"
# what modes can people temporarily tweet with
# these are channel modes, not flags on the bot
# you can use op, voice, or both, or "".
# (list)
set twitter(channel) [list "op" "voice"]
# Accts to tweet to
# "#channel|Login|Password[|tweet-format]"
# --
# Channel name here uses lowercase, your actual
# channel case is irrevelant. But here you must
# use lowercase only
# --
# tweet-format is entirely optional and used as
# an optional local over-ride. If no tweet-format
# is given the globaltwitterformat will be used.
# --
# (list)
set twitter(accts) {
"#yourchan|youracct|yourpass"
"#yourchan-ops|youracct|yourpass"
"#yourotherchan|your2ndacct|your2ndpass|<%nick:%chan> %text"
"#yourotherchan-ops|your2ndacct|your2ndpass|<%nick> %text"
}
# If you have megahal enabled, then you might want
# to set the below option to 1. With this set you
# can then use the chanset command:
# .chanset #yourchan +twittermega
# Now your bot will reply to twitter messages at
# set intervals just to keep your account active if
# users aren't posting. The bot will not post to the
# account if it was the last one to post.
# (0 off/1 on)
set twitter(megahal) 1
# If your using megahal on your twitter for reply
# tweets to your users, what timestring interval
# would you like to use? The default string of
# "?0*" will check if it can reply every
# 10 minutes, at exactly minutes ending with 0.
# (string)
set twitter(timestring) "?0*"
# do you want the bot to putlog when it's made
# replies? a setting of 0 will post it has in
# the channel associated to your account.
# (it will only announce in the first channel )
# (linked to your account. if multiple channels)
# (are used it won't display it's replied there)
# (this would be too spammy and floody... )
# (0 channel/1 putlog)
set twitter(silent) 0
# do you want your bot to learn from twitter
# tweets from users?
# (0 off/1 on)
set twitter(learn) 1
# Do you want @mentions to be relayed directly
# to IRC when they occur?
# (0 off/1 on)
set twitter(usementions) 1
# if your using megahal would you like your bot
# to also reply to your @mentions?
# (0 off/1 on)
set twitter(usemegareply) 1
# do you want your bot to learn from @mentions
# other users send it?
# (0 off/1 on)
set twitter(mentionlearn) 1
# set the time interval to check for new @mentions
# for each acct above? The default string of "?5*"
# will check if it can reply every 10 minutes, at
# exactly minutes ending with 5. This is so it doesn't
# collide with the timer above which posts to users
# using !tweet.
# (string)
set twitter(mentiontimestring) "?5*"
# set the limit of new @mentions the bot is going
# to be showing in channel, and/or replying to
# megahal each cycle
# (integer)
set twitter(mentionlimit) 2
# do you want the bot to putlog when it's made
# replies to private messages? a setting of 0
# will post it has in the channel associated to
# your account.
# (it will only announce in the first channel )
# (linked to your account. if multiple channels)
# (are used it won't display it's replied there)
# (this would be too spammy and floody... )
# (0 channel/1 putlog)
set twitter(mentionsilent) 0
Any comments, questions, problems, confusing bullshit not explained, other issues; feel free to shout them out in this thread..