Archive for the ‘Uncategorized’ Category

MVpybot: Update 2

Monday, January 18th, 2010

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 technical stuff. A listener is just a python file in the listeners folder, with functions defined in it. A function’s name should be botfunction_type, where type is the type of message to listen for (privmsg, join, part, etc) or it can be ‘any’ for all data received by the bot. Here is an example logger function:

#!/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()

As you can see from the example, plugins can be quickly enabled or disabled by toggling the ‘enabled’ flag. Also, ‘line’ is passed to the plugin. Not that anything outside of function definitions will be run when the bot starts.

Listeners can use the ’socket’ variable to send data to the server, as shown in this example:

#!/usr/bin/python

enabled=0

def botfunction_privmsg():
 print "called"
 out="PRIVMSG %s :Botfunction_privmsg called" %(channel)
 print out
 socket.send(out+'\n')

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:

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.

This only applies to privmsgs. All other events only get ’socket’ and ‘line’ passed and have to figure out everything from ‘line’

That’s all for now.

MVpybot: Update

Tuesday, December 22nd, 2009

Well, i’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. The variables channel, sender, nick, cmd, and run are passed to the function. The functions syscmd() and getlevel() are also passed to the plugin.

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’t have yacas installed) and getlevel, for demonstrating the ability to use the getlevel function in a plugin.

I have also set up a page for the bot, see the links bar below the logo.

Python IRC Bot in the Works

Saturday, December 5th, 2009

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 a channel)
  • Part (Part a channel)
  • Authorization (username+password)
  • Deauthorization
  • User lookup
  • Raw (Use raw IRC commands)
  • Uptime (Display uptime)
  • Math (Do math functions with Yacas)

Planned functions:

  • Encrypted passwords
  • Data storage, either in a text file or a MySQL DB
  • Channel mode control

This bot is not meant to be a complex bot, it is intended to be a fast, light bot that can be easily reprogrammed.

Comparison 3: Laptops

Sunday, November 8th, 2009

Since laptops are becoming more and more popular these days, I decided to finally do a comparison on laptops as opposed to desktops. I’ll compare two laptops from Apple, Dell, HP, and whatever other good deals I can find.

(more…)

Windows Equivalents of *nix Software

Friday, July 31st, 2009

There are a lot of pages out there that will give you a long list of Windows software with Linux equivalents. I decided to go the other way, and provide a list of Windows equivalents for common Unix and Linux software.

(more…)

Back Up

Thursday, July 30th, 2009

Mattventura.net and all of its services are back up after a power outage last night.

Roundicity Theme

Friday, July 24th, 2009

The Wordpress theme Roundicity that I made (well, actually modified, read the style.css file) is sort of complete, just needs better IE support. If you want to help, just send me an email. (mattventura.at.mattventura.net)

Feedback is welcomed in the comments, along with any questions you might have.

This theme does not work well in IE6. If you have IE6 users visiting your site, you should probably tell them to upgrade.

roundicity-0.9-alpha.tar.gz

A Big Boom

Friday, July 3rd, 2009

This is what happens when you follow the instructions in the previous post.

Video (WMV)

Video (mpeg)

Video (ogg/theora)

(The voice in the video is not me)

Part of it sounds like a bottle rocket is going off. This is because part of the firecracker was effectively a bottle rocket, and it should have exploded like the rest, but instead went to the side.

Read more for an awesome picture.

(more…)

A Quick Home-made Firecracker

Wednesday, July 1st, 2009

Since it’s near the 4th of July, I thought I’d post a safe (as safe as any other firecracker) way to get a nice big bang out of $5. Read on for instructions and photos.

(more…)

Another Comparison

Tuesday, June 30th, 2009

After I wrote my previous post, the complaints I got were mostly along the lines of “well, a $2500 computer is a nerd computer.” So I decided to do a much more reasonable comparison. I will now see what I can get for $999. This will be a comparison of desktop computers again, since trying to get a laptop for $999 would leave certain companies out in the cold.

(more…)