15
15
from sopel import tools
16
16
from sopel .module import OP , NOLIMIT , commands , example , require_chanmsg , rule , url
17
17
from sopel .formatting import bold , color , monospace
18
- from sopel .tools .time import get_timezone , format_time
18
+ from sopel .tools .time import get_timezone , format_time , seconds_to_human
19
19
from sopel .config .types import StaticSection , ValidatedAttribute
20
20
21
21
from .. import github as github_plugin
@@ -283,6 +283,10 @@ def commit_info(bot, trigger, match=None):
283
283
if body .strip () == '' :
284
284
body = 'No commit message provided.'
285
285
286
+ now = datetime .datetime .utcnow () # can't use trigger.time until it becomes Aware in Sopel 8
287
+ author_date = from_utc (data ['commit' ]['author' ]['date' ])
288
+ committer_date = from_utc (data ['commit' ]['committer' ]['date' ])
289
+
286
290
change_count = data ['stats' ]['total' ]
287
291
file_count = len (data ['files' ])
288
292
response = [
@@ -298,7 +302,11 @@ def commit_info(bot, trigger, match=None):
298
302
' change' if change_count == 1 else ' changes' ,
299
303
' in ' ,
300
304
str (file_count ),
301
- ' file' if file_count == 1 else ' files'
305
+ ' file' if file_count == 1 else ' files' ,
306
+ bold (' | ' ),
307
+ 'Authored ' + seconds_to_human ((now - author_date ).total_seconds ()),
308
+ bold (' | ' ),
309
+ 'Committed ' + seconds_to_human ((now - committer_date ).total_seconds ()),
302
310
]
303
311
bot .say ('' .join (response ))
304
312
0 commit comments