Jake Wright
tech guru
Back to top
Email to a friend Share on Facebook Share on FriendFeed Share on Twitter
Donate with PayPal

IRC Topic to RSS Feed via mIRC

This tutorial will show you how to create a topic bot in mIRC, and have that bot turn the topic into a text file and/or an RSS feed, and upload the file(s) to your website using FTP! Sounds cool, right? Let’s begin.

Firstly, you will need mIRC, a free trial is available from http://mirc.com. Once that is installed and running, you will want to connect it to your channel, something which I don’t intend to cover in this tutorial as it’s too basic. Then you need to open Tools > Scripts Editor.

In the remotes tab, you need the following block of code.


on 1:text:!topic *:#jake: {
if ( $nick isop $chan || $nick ishop $chan ) {
topic $chan $2-
write -c C:\topic\topic.txt $2-
write -c C:\topic\rss.txt <?xml version="1.0" ?><rss version="2.0"><channel><title>Chat Topic</title><description>The Topic of the chat at live.jakewright.net</description><link>http://live.jakewright.net</link><item><title>Topic: $2- </title><description>Topic: $2- </description><link>http://live.jakewright.met</link></item></channel></rss>
run C:\topic\createrss.bat
run ftp -s:C:\topic\ftp.txt
}
}

Text can also be found here: http://txtb.in/5Xg

The first line tells it to listen for a line beginning with !topic in a channel called #jake. Obviously you will need to change this to the name of your channel. The second line makes sure the user is an OP or HOP in the channel from which the command was activated. The third line sets the topic to the second word of the command (the first being !topic) and everything that follows (if you typed “!topic Golf Clubs” it would set the topic to “Golf Clubs”). You could add something like “/ http://jakewright.net” to the end of this line to automatically add something to the topic.

The next line simply writes a text file. The -c tells it to replace the current contents of the text file. Feel free to alter it to suite your needs. You may also change the file path and the name of the text file. The final bit ($2-) tells mIRC to write everything from the second word of the command to the file.

If a text file is not what you want, leave the previous line out, and just include line 5. This line writes to another text file (we’ll turn it into an RSS file later) with the syntax for an XML feed. You may change the information in this line to suite your needs, for example, change the links to your own website address.

The next two lines run two external scripts, which you must now create. You can create the batch file by creating a text file called createrss.bat.txt (as long as you uncheck the ‘hide file extensions…’ check box in the folder options), editing it, and then renaming it.

In the createrss.bat file, you’ll need the following code.


copy C:\topic\rss.txt C:\topic\rss
del C:\topic\rss\rss.xml
rename C:\topic\rss\rss.txt rss.xml
EXIT

These simple DOS commands move the rss.txt file to a sub folder (which you now need to create), delete the old rss.xml file (which you also need to create, so it has something to delete the first time it runs -- it just needs to be an empty file), and rename the new one so it has the .xml extension. Simple.

You will now need that last file that we referenced in the mIRC script: the ftp.txt file, containing the following code.


open ftp.example.com
topicbot@example.com
PASSWORD
lcd "C:\topic"
put topic.txt
lcd "C:\topic\rss"
put rss.xml
disconnect
bye
quit

Ok, so you need to change the first three lines (at least), filling in you own server address for your website, your own username (I recommend you make a new FTP account for this) and your FTP accounts password.

When you’ve done everything, get your mIRC bot into your channel and try it out. This works perfectly for me, and it has done so in Windows XP and Windows Server 2003. I don’t know what’ll happen in other operating systems, so…good luck.

  • Print
  • PDF
  • email
  • FriendFeed
  • Twitter
  • Ping.fm
  • Tumblr
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • StumbleUpon

Tags: , , , , , , , , , , , , , , , , ,

  • Hey, I set this up and it works really well, but how can I convert it into raw text for my website? Do you use some kind of converter?
  • Just take out all of the RSS/XML stuff from the mIRC part so it just writes plain text to the text file and then alter the batch files so the txt file isn't renamed to become an xml file - then you can just have it upload the original text file which the mIRC script generates. Does that make sense or have I misunderstood your question?
blog comments powered by Disqus
RSS Feed Subscribe by Email Comments RSS Feed
close

subscribe by email

close