-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from embolalia/master
Pull to my fork
- Loading branch information
Showing
48 changed files
with
235 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
collect_ignore = ["setup.py", "willie.py"] | ||
# This file lists files which should be ignored by pytest | ||
collect_ignore = ["setup.py", "willie.py", "willie/modules/ipython.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#coding: utf8 | ||
from __future__ import unicode_literals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
# -*- coding: utf8 -*- | ||
#coding: utf8 | ||
""" | ||
announce.py - Send a message to all channels | ||
Copyright © 2013, Elad Alfassa, <[email protected]> | ||
Licensed under the Eiffel Forum License 2. | ||
""" | ||
from __future__ import unicode_literals | ||
|
||
from willie.module import commands, example | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# coding=utf-8 | ||
#coding: utf8 | ||
""" | ||
chanlogs.py - Willie Channel Logger module | ||
Copyright 2014, David Baumgold <[email protected]> | ||
|
@@ -11,6 +11,7 @@ | |
import os | ||
import os.path | ||
import threading | ||
import sys | ||
from datetime import datetime | ||
import willie.module | ||
import willie.tools | ||
|
@@ -63,12 +64,16 @@ def _format_template(tpl, bot, **kwargs): | |
if not bot.config.chanlogs.microseconds: | ||
dt = dt.replace(microsecond=0) | ||
|
||
return tpl.format( | ||
formatted = tpl.format( | ||
origin=bot.origin, datetime=dt.isoformat(), | ||
date=dt.date().isoformat(), time=dt.time().isoformat(), | ||
**kwargs | ||
) + "\n" | ||
|
||
if sys.version_info.major < 3 and isinstance(formatted, unicode): | ||
formatted = formatted.encode('utf-8') | ||
return formatted | ||
|
||
|
||
def setup(bot): | ||
if not getattr(bot.config, "chanlogs", None): | ||
|
@@ -106,7 +111,7 @@ def log_message(bot, message): | |
fpath = get_fpath(bot) | ||
with bot.memory['chanlog_locks'][fpath]: | ||
with open(fpath, "a") as f: | ||
f.write(logline.encode('utf-8')) | ||
f.write(logline) | ||
|
||
|
||
@willie.module.rule('.*') | ||
|
@@ -118,7 +123,7 @@ def log_join(bot, trigger): | |
fpath = get_fpath(bot, channel=trigger) | ||
with bot.memory['chanlog_locks'][fpath]: | ||
with open(fpath, "a") as f: | ||
f.write(logline.encode('utf-8')) | ||
f.write(logline) | ||
|
||
|
||
@willie.module.rule('.*') | ||
|
@@ -130,7 +135,7 @@ def log_part(bot, trigger): | |
fpath = get_fpath(bot, channel=trigger) | ||
with bot.memory['chanlog_locks'][fpath]: | ||
with open(fpath, "a") as f: | ||
f.write(logline.encode('utf-8')) | ||
f.write(logline) | ||
|
||
|
||
@willie.module.rule('.*') | ||
|
@@ -149,7 +154,7 @@ def log_quit(bot, trigger): | |
fpath = get_fpath(bot, channel) | ||
with bot.memory['chanlog_locks'][fpath]: | ||
with open(fpath, "a") as f: | ||
f.write(logline.encode('utf-8')) | ||
f.write(logline) | ||
|
||
|
||
@willie.module.rule('.*') | ||
|
@@ -168,4 +173,4 @@ def log_nick_change(bot, trigger): | |
fpath = get_fpath(bot, channel) | ||
with bot.memory['chanlog_locks'][fpath]: | ||
with open(fpath, "a") as f: | ||
f.write(logline.encode('utf-8')) | ||
f.write(logline) |
Oops, something went wrong.