modules package

Submodules

modules.basemodule module

class modules.basemodule.BaseModule(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

A base module class for deriving modules (anything you fine folk write, probably) to inherit from. The nice this is this allows you to define your own post_init and handle functions.

In your module’s post_init, define and register your own events, and pass your module in.

def MyModule(BaseModule):
  def post_init(self):
    e = Event("__wee__")
    e.define("foo")
    self.bot.register_event(e,self)

Bam, you’ve got the things you need (a bot handle, mostly) and by extending BaseModule you implement the right things to be called without error. Elzar.

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.bofh module

class modules.bofh.Bofh(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.bonk module

class modules.bonk.Bonk(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_bonked(bonkee='')[source]
handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.choose module

class modules.choose.Choose(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.ctof module

class modules.ctof.Ctof(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.d20 module

class modules.d20.D20(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.dad module

class modules.dad.Dad(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.dance module

class modules.dance.Dance(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.debugger module

class modules.debugger.Debugger(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
mem_store_delete(mem_store_key)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

pretty(d, event, indent=0)[source]
recurse(obj)[source]

modules.diabeetus module

class modules.diabeetus.Diabeetus(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_glucose(channel)[source]

get the glucose

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.disconnect_yeller module

class modules.disconnect_yeller.Disconnect_Yeller(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.example module

class modules.example.Example(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

handle(event)[source]

modules.examplederived module

class modules.examplederived.ExampleDerived(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.ftoc module

class modules.ftoc.Ftoc(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.hello module

class modules.hello.Hello(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.help module

class modules.help.Help(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_help_lines()[source]
handle(event)[source]
individual_help(cmd, event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.howdy module

class modules.howdy.Howdy(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.isup module

class modules.isup.Isup(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

takes a url and determines if the site hosted there is up

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.jimmies module

class modules.jimmies.Jimmies(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_jimmies_status()[source]

Randomly selects and returns a string with a “jimmies” status.

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.jury module

class modules.jury.Jury(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.kanbomodule module

class modules.kanbomodule.KanboModule(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.lastfm module

class modules.lastfm.LastFM(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.meme module

class modules.meme.PhonyMc[source]

Bases: object

imgflip_password = 'None'
imgflip_userid = 'None'
class modules.meme.meme(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

check_rate(nick)[source]

Check to see if the given nick has allowed enough time to pass before calling meme again. Return True and set the new last meme time if true. Warn nick and return False if not.

compare_description(meme_name, user_description)[source]

compares two strings. if greater than 67% similarity, returns true

contains_url(line)[source]

Given a string, returns True if there is a url present

create_ignore_nicks_tuple()[source]

creates a tuple with all nicks from self.ignore_list in <>

create_meme(meme_id, top_line, bottom_line)[source]

Given a meme id from imgflip and two lines, top and bottom, submit a request to imgflip for a new meme and return the URL

format_string(line)[source]

Given an appropriate line, strip out <nick>. Otherwise return unmodified line

get_last_meme_time(nick)[source]

Given a channel name, return the last time .meme was called in that channel, return 0 if never used

get_line(array_of_lines)[source]

Given an array of lines from which to pick, randomly select an appropriate line, clean it up, and return the string.

get_random_flavor()[source]

Change up the flavor text when returning memes. It got boring before

get_random_meme_id()[source]

Selects a random id from the top_memes_list

get_top_memes()[source]

Makes an API call to imgflip to get top 100 most popular memes. Returns a list of results

get_user_lines(channel, nick)[source]

Given a specific nick and channel, create a list of all their lines in the buffer

handle(event)[source]
is_valid_line(line)[source]

Given a line from the qdb buffer, return True if certain conditions are met that make it good for meme selection. Return False if not

set_last_meme_time(nick)[source]

Upon calling meme, set the last time it was used by that nick

modules.module module

class modules.module.Module(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

handle(event)[source]
load(modulename)[source]
unload(modulename)[source]
unload_event(eventname)[source]

modules.nicklist module

class modules.nicklist.Nicklist(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.part module

class modules.part.Part(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

This command should be used as a private message to the bot or else it will not work

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.pimp module

class modules.pimp.Pimp(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.qdb module

class modules.qdb.QDB(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

add_buffer(event=None, debug=False)[source]

Takes a channel name and line passed to it and stores them in the bot’s mem_store dict for future access. The dict will have channel as key. The value to that key will be a list of formatted lines of activity. If the buffer size is not yet exceeded, lines are just added. If the buffer is maxed out, the oldest line is removed and newest one inserted at the beginning.

add_recently_submitted(q_id, submission)[source]

Takes a string, submission, and adds it to the list of recent submissions. Also we do length checking, only keep record of the previous MAX_HISTORY_SIZE quotes.

delete(user, post_id='', passcode='')[source]

A special function that allows certain users to delete posts

format_line(event)[source]

Takes an event and formats a string appropriate for quotation from it

get_qdb_submission(channel=None, start_msg='', end_msg='', strict=False)[source]

Given two strings, start_msg and end_msg, this function will assemble a submission for the QDB. start_msg is a substring to search for and identify a starting line. end_msg similarly is used to search for the last desired line in the submission. This function returns a string ready for submission to the QDB if it finds the desired selection. If not, it returns None.

handle(event)[source]
recently_submitted(submission)[source]

Checks to see if the given submission is string is at least 75% similar to the strings in the list of recently submitted quotes. Returns the id of the quote if it was recently submitted. If not, returns -1.

strip_formatting(msg)[source]

Uses regex to replace any special formatting in IRC (bold, colors) with nothing

submit(qdb_submission, debug=False)[source]

Given a string, qdb_submission, this function will upload the string to hlmtre’s qdb server. Returns a string with status of submission. If it worked, includes a link to new quote.

modules.r6 module

class modules.r6.R6(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

Takes specified stats from r6tab and prints them to irc channel

api_get(name)[source]

Needed to set user agent so request would not be blocked, without this a 503 status code is returned

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

print_stats(ids, js, choice)[source]

modules.recap module

class modules.recap.recap(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

check_rate(channel)[source]

Check to see if the given channel has allowed enough time to pass before calling recap again. Return True and set the new time limit if true. Return False if not.

contains_url(line)[source]

Given a string, returns True if there is a url present

create_ignore_nicks_tuple()[source]

creates a tuple with all nicks from self.ignore_list in <>

dramatize_line(line)[source]

Pass a valid line in, return line with some random type of dramatic formatting

get_episode()[source]

Return a list with two elements: a random show title and episode name

get_lines(channel)[source]

Given a channel, searches the qdb buffer for 4 random, suitable lines.

get_timediff(channel)[source]

Return how much time remains in the function lockdown

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

reset_timer(channel)[source]

If there’s an error getting a recap, call this to reset lockdown timer

scramble_nick(nick)[source]

Given a valid nick in the format <nickname>, scramble a vowel in the nick to avoid beeping the user

valid_line(line)[source]

Returns True if a given line matches all requirements for validity: Not an action line, longer than minimum length, not spoken by ignored nicks, no URLs

modules.redditinfo module

modules.replace module

class modules.replace.Replace(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

add_buffer(event=None, debug=False)[source]

Takes a channel name and line passed to it and stores them in the bot’s mem_store dict for future access. The dict will have channel as key. The value to that key will be a list of formatted lines of activity. If the buffer size is not yet exceeded, lines are just added. If the buffer is maxed out, the oldest line is removed and newest one inserted at the beginning.

format_line(event)[source]

Takes an event and formats a string appropriate for quotation from it

get_replacement_message(channel=None, find_msg='')[source]

Looks through the mem_store to find the most recent message containing find_msg

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.replay module

class modules.replay.Replay(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

get_replacement_message(channel=None, find_msg='')[source]

Looks through the mem_store to find the most recent message containing find_msg

handle(event)[source]
is_number(e)[source]

modules.seen module

class modules.seen.Seen(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
mem_store_init()[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.shortener module

class modules.shortener.Shortener(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.tell module

class modules.tell.Notice(subj, obj, message)[source]

Bases: object

class modules.tell.Tell(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Because of the way this module works we have to make sure to set our event like we normally would with __.tell__, but we cannot define our event with “^.tell” like we normally would as it will only look for that line to trigger the event and the user being told will never receive his message since the bot is only looking for .tell and not the user in the PRIVMSG

We will set the .tell trigger in our handle function “if event.msg.startswith(“.tell”):” and set define to PRIVMSG so it searches all lines from users. While simultaneously looking for the .tell trigger from the user.

This is because we actually need 2 things for this module to work.

1.) The user needs to be able to leave a message for someone else using “.tell someuser <Insert message here>”

2.) The user who the .tell message is directed towards will be determined by the PRIVMSG definition.
This is determined in the “else” block that searches every line not starting with .tell. If the user matches the stored user from the previous tell trigger, the event will be triggered and pybot will spit out text into the proper channel every time the intended user says something in chat until the buffer is out of .tell events.

modules.told module

class modules.told.Told(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_told_status(target)[source]

Randomly selects and returns a string with a “told” status.

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.twitterposter module

class modules.twitterposter.TwitterPoster(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

class PhonyPt[source]

Bases: object

access_token = ''
access_token_secret = ''
api_key = ''
api_secret = ''
handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

pt = <modules.twitterposter.TwitterPoster.PhonyPt object>
user_to_track = 'bhhorg'

modules.tzone module

class modules.tzone.Tzone(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

request_api(location)[source]

Takes the location provided and determines whether its a valid request and will return either the time of the location or a message instructing you how to the make the proper call

modules.uptime module

class modules.uptime.Uptime(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.vyos module

Works only in hlmtre’s specifically configured environment and when his house has not burned down

class modules.vyos.Vyos(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
ping(nick)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.weather module

class modules.weather.Weather(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

get_api_request(x, y)[source]

Simple form the query string and return it.

get_conditions(query, channel)[source]

given a fully formed query to the OpenWeatherMap API, format an output string

get_lat_long_from_bing(location)[source]

go grab the latitude/longitude from bing’s really excellent location API. Returns: tuple of x,y coordinates - (0,0) on error

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

modules.welcome module

class modules.welcome.Welcome(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: object

handle(event)[source]

modules.youtube module

class modules.youtube.Youtube(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

print_video_title(event, url, video_tag)[source]

modules.yth module

class modules.yth.YTH(events=None, printer_handle=None, bot=None, say=None)[source]

Bases: modules.basemodule.BaseModule

handle(event)[source]
post_init()[source]

Called after init is set up and builds out our basic module’s needs. Allows you to do your own post-processing when inheriting from BaseModule.

Module contents