Skip to content

Instantly share code, notes, and snippets.

@PEM-FR
Created September 7, 2012 18:37
Show Gist options
  • Save PEM-FR/3668449 to your computer and use it in GitHub Desktop.
Save PEM-FR/3668449 to your computer and use it in GitHub Desktop.
meeting summary module for phenny
#!/usr/bin/env python
"""
meeting_summary.py - Phenny meeting_summary Module
"""
import datetime as dt
from tools import deprecated
startTime = 0
stopTime = 0
elapsed = 0
agenda = []
def meetingStart(phenny, input):
""".meetingStart - starts a new meeting."""
startTime = dt.datetime.now()
t = str(startTime)
msg = "Meeting started at %s on %s" % (t, input.sender)
return phenny.reply(msg)
meetingStart.rule = (['meetingStart'], r'(\S+)')
def meetingStop(phenny, input):
""".meetingStop - stops a meeting."""
stopTime = dt.datetime.now()
t = str(stopTime)
elapsed = str(stopTime - startTime)
msg = "Meeting stopped at %s on %s - meeting lasted for %s" % (t, input.sender, elapsed)
return phenny.reply(msg)
meetingStop.rule = (['meetingStop'], r'(\S+)')
def addAgenda(phenny, input):
""".addAgenda <topic> - adds an agenda."""
topic = input.group(2)
agenda.append(topic)
msg = "Adding topic %s to Meeting Agenda. Currently having %d topic(s)" % (topic, len(agenda))
return phenny.reply(msg)
addAgenda.rule = (['addAgenda'], r'(\S+)')
if __name__ == '__main__':
print __doc__.strip()
@PEM-FR
Copy link
Author

PEM-FR commented Sep 7, 2012

working solution :

!/usr/bin/env python

"""
meeting_summary.py - Phenny meeting_summary Module
"""

import datetime as dt
from tools import deprecated

startTime = 0
stopTime = 0
elapsed = 0
agenda = []

def meetingStart(phenny, input):
""".meetingStart - starts a new meeting."""
global startTime
startTime = dt.datetime.now()
t = str(startTime)
msg = "Meeting started at %s on %s" % (t, input.sender)
return phenny.reply(msg)
meetingStart.rule = (['meetingStart'], r'(\S+)')

def meetingStop(phenny, input):
""".meetingStop - stops a meeting."""
global startTime, elapsed
stopTime = dt.datetime.now()
t = str(stopTime)
elapsed = str(stopTime - startTime)
msg = "Meeting stopped at %s on %s - meeting lasted for %s" % (t, input.sender, elapsed)
return phenny.reply(msg)
meetingStop.rule = (['meetingStop'], r'(\S+)')

def addAgenda(phenny, input):
""".addAgenda - adds an agenda."""
topic = input.group(2)
agenda.append(topic)
msg = "Adding topic %s to Meeting Agenda. Currently having %d topic(s)" % (topic, len(agenda))
return phenny.reply(msg)
addAgenda.rule = (['addAgenda'], r'(\S+)')

if name == 'main':
print doc.strip()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment