modules package¶
Subpackages¶
- modules.snippets package
- Submodules
- modules.snippets.commandtest module
- modules.snippets.d10 module
- modules.snippets.d12 module
- modules.snippets.d4 module
- modules.snippets.d6 module
- modules.snippets.d8 module
- modules.snippets.downtime module
- modules.snippets.platypus module
- modules.snippets.reflect module
- modules.snippets.second_in_command_test module
- modules.snippets.snippetutil module
- Module contents
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.
modules.bofh module¶
modules.bonk module¶
modules.choose module¶
modules.ctof module¶
modules.d20 module¶
modules.dad module¶
modules.dance module¶
modules.debugger module¶
-
class
modules.debugger.
Debugger
(events=None, printer_handle=None, bot=None, say=None)[source]¶
modules.diabeetus module¶
modules.disconnect_yeller module¶
modules.example module¶
modules.examplederived module¶
modules.ftoc module¶
modules.hello module¶
modules.help module¶
modules.howdy module¶
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
modules.jimmies module¶
modules.jury module¶
modules.kanbomodule module¶
modules.lastfm module¶
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
-
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_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
-
modules.module module¶
modules.nicklist module¶
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
modules.pimp module¶
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
-
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.
-
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.
-
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
-
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.
-
dramatize_line
(line)[source]¶ Pass a valid line in, return line with some random type of dramatic formatting
-
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
-
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.
-
modules.replay module¶
modules.seen module¶
modules.shortener module¶
-
class
modules.shortener.
Shortener
(events=None, printer_handle=None, bot=None, say=None)[source]¶
modules.tell module¶
-
class
modules.tell.
Tell
(events=None, printer_handle=None, bot=None, say=None)[source]¶ Bases:
modules.basemodule.BaseModule
-
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¶
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
= ''¶
-
-
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'¶
-
class
modules.tzone module¶
-
class
modules.tzone.
Tzone
(events=None, printer_handle=None, bot=None, say=None)[source]¶
modules.uptime module¶
modules.vyos module¶
Works only in hlmtre’s specifically configured environment and when his house has not burned down
modules.weather module¶
-
class
modules.weather.
Weather
(events=None, printer_handle=None, bot=None, say=None)[source]¶ Bases:
modules.basemodule.BaseModule
-
get_conditions
(query, channel)[source]¶ given a fully formed query to the OpenWeatherMap API, format an output string
-
modules.welcome module¶
modules.youtube module¶
-
class
modules.youtube.
Youtube
(events=None, printer_handle=None, bot=None, say=None)[source]¶