class bucket_runtime_data(): dont_know_cache = [] # Caching all the Don't Know factoids to reduce amount of DB reads what_was_that = {} # Remembering info of last DB read, per channel. for use with the "what was that" command. inhibit_reply = '' # Used to inhibit reply of an error message after teaching a factoid last_teach = {} last_lines = Ddict(dict) # For quotes. inventory = None shut_up = [] special_verbs = ['<reply>', '<directreply>', '<directaction>', '<action>', '<alias>'] factoid_search_re = re.compile('(.*).~=./(.*)/')
def startmeeting(bot, trigger): """ Start a meeting. https://github.com/embolalia/willie/wiki/Using-the-meetbot-module """ if ismeetingrunning(trigger.sender): bot.say('Can\'t do that, there is already a meeting in progress here!') return if not trigger.sender.startswith('#'): bot.say('Can only start meetings in channels') return if not bot.config.has_section('meetbot'): bot.say( 'Meetbot not configured, make sure meeting_log_path and meeting_log_baseurl are defined' ) return #Start the meeting meetings_dict[trigger.sender]['start'] = time.time() if not trigger.group(2): meetings_dict[trigger.sender]['title'] = 'Untitled meeting' else: meetings_dict[trigger.sender]['title'] = trigger.group(2) meetings_dict[trigger.sender]['head'] = trigger.nick.lower() meetings_dict[trigger.sender]['running'] = True meetings_dict[trigger.sender]['comments'] = [] global meeting_log_path meeting_log_path = bot.config.meetbot.meeting_log_path if not meeting_log_path.endswith('/'): meeting_log_path = meeting_log_path + '/' global meeting_log_baseurl meeting_log_baseurl = bot.config.meetbot.meeting_log_baseurl if not meeting_log_baseurl.endswith('/'): meeting_log_baseurl = meeting_log_baseurl + '/' if not os.path.isdir(meeting_log_path + trigger.sender): try: os.makedirs(meeting_log_path + trigger.sender) except Exception as e: bot.say( "Can't create log directory for this channel, meeting not started!" ) meetings_dict[trigger.sender] = Ddict(dict) raise return #Okay, meeting started! logplain('Meeting started by ' + trigger.nick.lower(), trigger.sender) logHTML_start(trigger.sender) meeting_actions[trigger.sender] = [] bot.say( 'Meeting started! use .action, .agreed, .info, .chairs, .subject and .comments to control the meeting. to end the meeting, type .endmeeting' ) bot.say( 'Users without speaking permission can use .comment ' + trigger.sender + ' followed by their comment in a PM with me to vocalize themselves.')
class bucket_runtime_data(): what_was_that = {} # Remembering info of last DB read, per channel. inhibit_reply = '' # Used to inhibit reply of an error message after teaching a factoid last_teach = {} last_lines = Ddict(dict) # For quotes. inventory = None shut_up = [] special_verbs = [ '<reply>', '<directreply>', '<directaction>', '<action>', '<alias>' ] factoid_search_re = re.compile('(.*).~=./(.*)/') question_re = re.compile( '^(how|who|why|which|what|whom|where|when) (is|are) .*\?$', re.IGNORECASE) last_said = {} cached_friends = []
def endmeeting(bot, trigger): """ End a meeting. https://github.com/embolalia/willie/wiki/Using-the-meetbot-module """ if not ismeetingrunning(trigger.sender): bot.say('Can\'t do that, start meeting first') return if not ischair(trigger.nick, trigger.sender): bot.say('Only meeting head or chairs can do that') return meeting_length = time.time() - meetings_dict[trigger.sender]['start'] #TODO: Humanize time output bot.say("Meeting ended! total meeting length %d seconds" % meeting_length) logHTML_end(trigger.sender) htmllog_url = meeting_log_baseurl + urllib2.quote(trigger.sender + '/' + figure_logfile_name(trigger.sender) + '.html') logplain('Meeting ended by %s, total meeting length %d seconds' % (trigger.nick, meeting_length), trigger.sender) bot.say('Meeting minutes: ' + htmllog_url) meetings_dict[trigger.sender] = Ddict(dict)
# -*- coding: utf8 -*- """ seen.py - Willie Seen Module Copyright 2008, Sean B. Palmer, inamidst.com Copyright © 2012, Elad Alfassa <*****@*****.**> Licensed under the Eiffel Forum License 2. http://willie.dftba.net """ import time import datetime import pytz from willie.tools import Ddict, Nick seen_dict = Ddict(dict) def get_user_time(willie, nick): tz = 'UTC' tformat = None if willie.db and nick in willie.db.preferences: tz = willie.db.preferences.get(nick, 'tz') or 'UTC' tformat = willie.db.preferences.get(nick, 'time_format') if tz not in pytz.all_timezones_set: tz = 'UTC' return (pytz.timezone(tz.strip()), tformat or '%Y-%m-%d %H:%M:%S %Z') def seen(willie, trigger): """Reports when and where the user was last seen."""
| --------- | ------- | ------- | | meeting_log_path | /home/willie/www/meetings | Path to meeting logs storage directory (should be an absolute path, accessible on a webserver) | | meeting_log_baseurl | http://example.com/~willie/meetings | Base URL for the meeting logs directory | """ if config.option('Configure meetbot', False): config.interactive_add( 'meetbot', 'meeting_log_path', "Path to meeting logs storage directory (should be an absolute path, accessible on a webserver)" ) config.interactive_add( 'meetbot', 'meeting_log_baseurl', "Base URL for the meeting logs directory (eg. http://example.com/logs)" ) meetings_dict = Ddict(dict) # Saves metadata about currently running meetings """ meetings_dict is a 2D dict. Each meeting should have: channel time of start head (can stop the meeting, plus all abilities of chairs) chairs (can add infolines to the logs) title current subject comments (what people who aren't voiced want to add) Using channel as the meeting ID as there can't be more than one meeting in a channel at the same time. """ meeting_log_path = '' # To be defined on meeting start as part of sanity checks, used by logging functions so we don't have to pass them bot