<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt Ventura&#039;s blog &#187; irc</title>
	<atom:link href="http://mattventura.net/tag/irc/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattventura.net</link>
	<description>Matt Ventura&#039;s blog about various stuff.</description>
	<lastBuildDate>Sun, 15 Aug 2010 01:17:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MVpybot: Update 2</title>
		<link>http://mattventura.net/2010/01/18/mvpybot-update-2/</link>
		<comments>http://mattventura.net/2010/01/18/mvpybot-update-2/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 07:06:41 +0000</pubDate>
		<dc:creator>Matt Ventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[mvpybot]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mattventura.net/?p=278</guid>
		<description><![CDATA[I just did another major update to MVpybot. Listeners have been implemented. A listener is a function that gets called whenever the bot receives data, or it can be set to only be called when a certain type (privmsg, join, part, etc) is received. As usual, the source is at the SVN repo.
Now for the [...]]]></description>
			<content:encoded><![CDATA[<p>I just did another major update to MVpybot. Listeners have been implemented. A listener is a function that gets called whenever the bot receives data, or it can be set to only be called when a certain type (privmsg, join, part, etc) is received. As usual, the source is at <a title="SVN" href="http://theoks.net/viewvc/mvpybot/">the SVN repo</a>.</p>
<p>Now for the technical stuff. A listener is just a python file in the listeners folder, with functions defined in it. A function&#8217;s name should be botfunction_type, where type is the type of message to listen for (privmsg, join, part, etc) or it can be &#8216;any&#8217; for all data received by the bot. Here is an example logger function:</p>
<pre>#!/usr/bin/python

import time

enabled=1

logfile=open('log','a')
timestamp=time.strftime('[ Session starting at %y-%m-%d %H:%M:%S ]')
logfile.write(timestamp+'\n')
logfile.close()

def botfunction_any():
 logfile=open('log','a')
 timestamp=time.strftime('[%y-%m-%d %H:%M:%S] ')
 logfile.write(timestamp+line+'\n')
 logfile.close()</pre>
<p>As you can see from the example, plugins can be quickly enabled or disabled by toggling the &#8216;enabled&#8217; flag. Also, &#8216;line&#8217; is passed to the plugin. Not that anything outside of function definitions will be run when the bot starts.</p>
<p>Listeners can use the &#8217;socket&#8217; variable to send data to the server, as shown in this example:</p>
<pre>#!/usr/bin/python

enabled=0

def botfunction_privmsg():
 print "called"
 out="PRIVMSG %s :Botfunction_privmsg called" %(channel)
 print out
 socket.send(out+'\n')</pre>
<p>Note that in the example, it uses botfunction_privmsg. To make listeners easier to write, the main program will automatically figure out these variables from privmsgs and pass them to the function:</p>
<pre>info         #user info
msg          #the message
channel      #the channel the message was from (set to the sender for private messages)
sender       #the sender of the message
senderstuff  #info of the sender
isprivate    #whether or not the message was a private message as opposed to a channel message.</pre>
<p>This only applies to privmsgs. All other events only get &#8217;socket&#8217; and &#8216;line&#8217; passed and have to figure out everything from &#8216;line&#8217;</p>
<p>That&#8217;s all for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattventura.net/2010/01/18/mvpybot-update-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MVpybot: Update</title>
		<link>http://mattventura.net/2009/12/22/mvpybot-update/</link>
		<comments>http://mattventura.net/2009/12/22/mvpybot-update/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 23:29:18 +0000</pubDate>
		<dc:creator>Matt Ventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[mvpybot]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mattventura.net/?p=262</guid>
		<description><![CDATA[Well, i&#8217;ve finally gotten around to putting out some decent source for the bot. Here it is. There is also an addon system. To make an addon, simply make a python file in the botplugins/ folder and put your code in, like this:
#!/usr/bin/python 

def test():
 return("PRIVMSG %s :test" %(channel))
This would make a function called test. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, i&#8217;ve finally gotten around to putting out some decent source for the bot. <a href="http://theoks.net/viewvc/mvpybot/">Here it is.</a> There is also an addon system. To make an addon, simply make a python file in the botplugins/ folder and put your code in, like this:</p>
<pre>#!/usr/bin/python 

def test():
 return("PRIVMSG %s :test" %(channel))</pre>
<p>This would make a function called test. The variables channel, sender, nick, cmd, and run are passed to the function. The functions syscmd() and getlevel() are also passed to the plugin.</p>
<p>The default plugins that are included with the bot are ping, for pinging addresses, testplugin, for testing the bot, yacas, for doing math with yacas (delete it if you don&#8217;t have yacas installed) and getlevel, for demonstrating the ability to use the getlevel function in a plugin.</p>
<p>I have also set up a page for the bot, see the links bar below the logo.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattventura.net/2009/12/22/mvpybot-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python IRC Bot in the Works</title>
		<link>http://mattventura.net/2009/12/05/python-irc-bot-in-the-works/</link>
		<comments>http://mattventura.net/2009/12/05/python-irc-bot-in-the-works/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 20:59:01 +0000</pubDate>
		<dc:creator>Matt Ventura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.mattventura.net/?p=254</guid>
		<description><![CDATA[*** Update ***: Main page for bot here
I am currently writing a small, fast, small-footprint IRC bot in Python. More details as I finish the bot. The functions created so far:

Help (Displays Help)
Echo (Echo back a message)
Say (Send a message to a channel)
Spam (Send a message to a channel a specified amount of times)
Join (Join [...]]]></description>
			<content:encoded><![CDATA[<p>*** Update ***: Main page for bot <a href="/mvpybot/">here</a></p>
<p>I am currently writing a small, fast, small-footprint IRC bot in Python. More details as I finish the bot. The functions created so far:</p>
<ul>
<li>Help (Displays Help)</li>
<li>Echo (Echo back a message)</li>
<li>Say (Send a message to a channel)</li>
<li>Spam (Send a message to a channel a specified amount of times)</li>
<li>Join (Join a channel)</li>
<li>Part (Part a channel)</li>
<li>Authorization (username+password)</li>
<li>Deauthorization</li>
<li>User lookup</li>
<li>Raw (Use raw IRC commands)</li>
<li>Uptime (Display uptime)</li>
<li>Math (Do math functions with Yacas)</li>
</ul>
<p>Planned functions:</p>
<ul>
<li>Encrypted passwords</li>
<li>Data storage, either in a text file or a MySQL DB</li>
<li>Channel mode control</li>
</ul>
<p>This bot is not meant to be a complex bot, it is intended to be a fast, light bot that can be easily reprogrammed.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattventura.net/2009/12/05/python-irc-bot-in-the-works/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
