def endmeeting(bot, trigger): """ End a meeting.\ See [meetbot module usage]({% link _usage/meetbot-module.md %}) """ 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( bold("Meeting ended!") + " total meeting length %d seconds" % meeting_length) logHTML_end(trigger.sender) htmllog_url = meeting_log_baseurl + 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) del meeting_actions[trigger.sender]
def startmeeting(bot, trigger): """ Start a meeting. https://github.com/embolalia/sopel/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 trigger.is_privmsg: 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.')
def startmeeting(bot, trigger): """ Start a meeting.\ See [meetbot module usage]({% link _usage/meetbot-module.md %}) """ if ismeetingrunning(trigger.sender): bot.say('Can\'t do that, there is already a meeting in progress here!') return if trigger.is_privmsg: bot.say('Can only start meetings in channels') 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: # TODO: Be specific 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( bold('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 setup(bot): bot.config.define_section('bucket', BucketSection) db_host = bot.config.bucket.db_host db_user = bot.config.bucket.db_user db_pass = bot.config.bucket.db_pass db_name = bot.config.bucket.db_name engine = create_engine('mysql+pymysql://%s:%s@%s/%s?charset=utf8mb4' % (db_user, db_pass, db_host, db_name), encoding='utf8') # Catch any errors connecting to MySQL try: engine.connect() except OperationalError: print("OperationalError: Unable to connect to MySQL database.") raise # Create MySQL tables Base.metadata.create_all(engine) # Initialize our RNG seed() # Ensure that required variables are in memory if not bot.memory.contains('inventory'): bot.memory['inventory'] = Inventory() if not bot.memory.contains('last_teach'): bot.memory['last_teach'] = {} if not bot.memory.contains('last_said'): bot.memory['last_said'] = {} if not bot.memory.contains('last_lines'): bot.memory['last_lines'] = Ddict(dict) # For quotes. # Set up a session for database interaction session = scoped_session(sessionmaker()) session.configure(bind=engine) bot.memory['session'] = session # Populate the bot's inventory bot.memory['inventory'].populate(bot)
def endmeeting(bot, trigger): """ End a meeting. https://github.com/sopel-irc/sopel/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 + 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) del meeting_actions[trigger.sender]
for initiative in keys: for actor in self.initiatives[initiative]: table = table + ("\n" + actor.get_init_string()) if initiative is self.tick: table = table + " [Active]" final_string = final_string + table return final_string def get_all_actor_status(self): """Displays a formatted table of all current actors in scene""" header = "Round: " + self.round + " - Tick: " + self.tick final_string = header return final_string __SCENES__ = Ddict() """ __SCENES__ is just a dictionary for holding data on active scene data. """ @sopel.module.commands("startscene") @sopel.module.commands("sscene") @sopel.module.example(".sscene", "Started Scene: [CHANNEL_NAME]") def start_scene(bot, trigger): """Starts a new scene in the sending channel.""" if trigger.is_privmsg: return bot.reply( "I don't support starting scenes through private messages. Stick to a channel, please." )
def configure(config): config.define_section('meetbot', MeetbotSection) config.meetbot.configure_setting('meeting_log_path', 'Enter the directory to store logs in.') config.meetbot.configure_setting( 'meeting_log_baseurl', 'Enter the base URL for the meeting logs.', ) def setup(bot): bot.config.define_section('meetbot', MeetbotSection) 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