Archive for the ‘Uncategorized’ Category

MVpybot Major Update

Saturday, June 26th, 2010

There is a somewhat-major bot update in the works. The plugins system has been completely redone. Instead of plugin files being used for whatever functions can be found in them, they now have to explicitly register functions. Here is an example, the rewritten ping plugin:

#!/usr/bin/python

def register():
 registerfunction('ping', ping)
 addhelp('ping', help_ping)

def ping():
 outstuff=''
 print "ping called"
 if (len(cmd)<2):
  return('PRIVMSG %s :Incorrect usage. Syntax: ping (4|6) <address>.' %(channel))
 else:
  if cmd[1]=='4' or cmd[1]=='6':
   if cmd[1]=='4':

    output=syscmd(['ping','-c','5','-i','0.2',cmd[2]])
    outsplit=output.split('\n')
    outparts=outsplit[-3:-1]
    for part in outparts:
     outstuff+='PRIVMSG %s :%s\n' %(channel,part) 

   if cmd[1]=='6':

    output=syscmd(['ping6','-c','5','-i','0.2',cmd[2]])
    outsplit=output.split('\n')
    outparts=outsplit[-3:-1]
    for part in outparts:
     outstuff+='PRIVMSG %s :%s\n' %(channel,part)
  return(outstuff)
  else:
   return('PRIVMSG %s :Error: protocol must be either 4 or 6' %channel)

def help_ping():
 return('PRIVMSG %s :Pings an internet address. Usage: ping (4|6) <address>.' %(channel))

A plugin’s register() function is called when the plugin is loaded. It can use registerfunction(), addlistener(), and addhelp(). You can use each function as many times as you want, in case you have multiple functions and/or listeners, or if you want to include help with your plugin.

Read more to find out how to use the new plugin features.

(more…)

More MVpybot stuff

Friday, April 30th, 2010

First of all, while I figure out how to have a system for hosting modules, I will put modules in mattventura.net/mvpybot/modules. Secondly, a bug tracking system is being set up.

Lastly, I will be improving the plugin system, and I will try to make older plugins backwards-compatible, but the new system will make the plugin system more efficient. Instead of always having to scan for functions in plugins whenever a certain command is called, all function plugins will register in a list of plugins upon being loaded. This has the advantage of also allowing plugin authors to specify what functions are actual functions for the bot to use.

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

*** 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 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.

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

Workstation Pictures

Wednesday, June 24th, 2009

Read on for some nice pictures of my workstation.

(more…)

Getting Another Server Soon

Saturday, June 13th, 2009

This site will soon be getting another server in adition to the main one. This on could be a database server among other things.

Going for 100 and 100,000

Sunday, May 10th, 2009

The server is currently at 85 days, 10mins of uptime as of this post. I am going for 100. Hopefully, there will not be a >1hour power failure, or a software crash (there never has been). I will be going for 200 days of uptime after this. I’d also like to thank the Debian team for a rock-solid OS.

Update: A live tracker is up: http://mattventura.net/uptime

Also, mattventura.net has a folding@home team (team 161515). The team will hit 100,000 points in a few days. I hope to pick up a few members to speed up the team. The team, in it’s current state, will hit 1,000,000 points in about six months. Anyone who wants to join is welcome. If you contribute, I will give you a link back to your site on a page on this site that will list all the contributors to the team (currently only me).