#!/usr/bin/python
+# vim: fileencoding=utf-8
# Erebus IRC bot - Author: John Runyon
# "Bot" and "BotConnection" classes (handling a specific "arm")
# Erebus IRC bot - Author: John Runyon
+# vim: fileencoding=utf-8
# "Config" class (reading/providing access to bot.config)
from __future__ import print_function
# Erebus IRC bot - Author: John Runyon
+# vim: fileencoding=utf-8
# module loading/unloading/tracking code
from __future__ import print_function
#!/usr/bin/python
+# vim: fileencoding=utf-8
# Erebus IRC bot - Author: John Runyon
# main startup code
# Erebus IRC bot - Author: John Runyon
+# vim: fileencoding=utf-8
# module helper functions, see modules/modtest.py for usage
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# chanop commands
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# simple coin module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# Various highly recommended "control" commands.
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# !EVAL and !EXEC commands
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# simple module example
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# help module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# This file is released into the public domain; see http://unlicense.org/
# module info
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# resource-usage module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# twilio sms module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# staff list module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# module for 's/regex/replacement/' style correction
# see for usage examples: https://github.com/zonidjan/erebus/commit/d7e9802778477f1faa26a03078cb1b3c018a5e5c
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# trivia module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# URL Checker
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# userinfo module
# This file is released into the public domain; see http://unlicense.org/
# Erebus IRC bot - Author: Erebus Team
+# vim: fileencoding=utf-8
# weather module
# This file is released into the public domain; see http://unlicense.org/
def _weather(place):
if place is not None:
- weather = json.load(urlopen('http://api.wunderground.com/api/8670e6d2e69ff3c7/conditions/q/%s.json' % (place)))
+ weather = json.load(urlopen(('http://api.wunderground.com/api/8670e6d2e69ff3c7/conditions/q/%s.json' % (place)).encode('utf8')))
if lib.parent.cfg.getboolean('debug', 'weather'):
lib.parent.log('*', "?", repr(weather))
if 'response' in weather:
measuredatTZ = '(actual time unknown)'
loc = current['observation_location']
if loc['city'] == "" or loc['state'] == "": loc = current['display_location']
- return u"Weather in %(location)s: As of %(time)s %(tz)s, %(conditions)s, %(cel)s\u00B0C (%(far)s\u00B0F) (feels like %(flcel)s\u00B0C (%(flfar)s\u00B0F)). Wind %(wind)s. %(link)s" % {
+ return u"Weather in %(location)s: As of %(time)s %(tz)s, %(conditions)s, %(cel)s°C (%(far)s°F) (feels like %(flcel)s°C (%(flfar)s°F)). Wind %(wind)s. %(link)s" % {
'location': loc['full'],
'time': time.strftime("%a %H:%M", tuple(measuredat)), # now we have to turn it back into a tuple because Py3's time.strftime requires it.
'tz': measuredatTZ,
@lib.hook(('weatheruser','wu'))
@lib.help('<user>', 'show weather for <user>\'s location')
+@lib.argsEQ(1)
def wu(bot, user, chan, realtarget, *args):
bot.msg(chan, _weather(location(' '.join(args))))
+# vim: fileencoding=utf-8
import sys
if sys.version_info.major < 3:
sys.setdefaultencoding('utf-8')