Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: bf186ac734
...
compare: 9a4bd3393a
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 01, 2012
ally gator iono 4a47a86
ally gator Merge branch 'master' of github.com:Alligator/homero 9a4bd33
Showing with 17 additions and 6 deletions.
  1. +16 −3 plugins/ircstats.py
  2. +1 −3 plugins/topichistory.py
View
19 plugins/ircstats.py
@@ -27,8 +27,8 @@ def ircstats(paraml, input=None, bot=None):
# im so sorry
pass
- now = datetime.datetime.today()
- past = datetime.datetime.today() - datetime.timedelta(hours=24)
+ now = datetime.datetime.utcnow()
+ past = datetime.datetime.utcnow() - datetime.timedelta(hours=24)
# put the data in the dict
nick = input['nick']
@@ -54,7 +54,8 @@ def ircstats(paraml, input=None, bot=None):
for i in range(24):
posters_out[p]['hours_active'].append([x.hour for x in posters[p]['hours_active']].count(i))
- sort = {'posters': sorted(posters_out.iteritems(), key=lambda x: x[1]['total_posts'], reverse=True)[:10], 'total': total}
+ top10 = sorted(posters_out.iteritems(), key=lambda x: x[1]['total_posts'], reverse=True)[:10]
+ sort = {'posters': top10, 'total': sum([n[1]['total_posts'] for n in top10]), 'now': now.hour}
# make a template
env = jinja2.Environment(loader=jinja2.FileSystemLoader('/var/www/ircstats/templates'))
@@ -62,8 +63,20 @@ def ircstats(paraml, input=None, bot=None):
f = open('/var/www/ircstats/index.html', 'w')
f.write(temp.render(**sort))
+ # remove people with 0 posts
+ for key, val in posters.iteritems():
+ if val['total_posts'] == 0:
+ del posters[key]
+
# pickle the dict
f = open(os.path.join(bot.persist_dir, 'ircstats.pkl'), 'wb')
pickle.dump(posters, f)
pickle.dump(total, f)
f.close()
+
+@hook.event('NICK')
+def nickchange(paraml, nick=None, chan=None):
+ if not chan == '#sa-minecraft':
+ return
+ posters[paraml[0]] = posters[nick]
+ del posters[nick]
View
4 plugins/topichistory.py
@@ -29,9 +29,7 @@ def topic(inp, chan=None, db=None):
if not t:
return "no previous topics found"
- out = ""
- for topic in t:
- out += topic[0] + '\n'
+ out = '\n\n'.join([topic[0] for topic in t])
register_openers()
datagen, headers = multipart_encode({'sprunge': out})

No commit comments for this range

Something went wrong with that request. Please try again.