Make some things easier for me

master
sfan5 2014-09-19 19:45:50 +02:00
parent 7fd2115116
commit 31548dd090
1 changed files with 9 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Copyright 2013, sfan5
import time
import re
import web
import os
import feedparser # sudo pip install feedparser
rssnotify = {}
@ -29,14 +30,13 @@ def excepta(arr, exclude):
return o
rssnotify["last_updated_feeds"] = {}
rssnotify["logfilepath"] = os.getcwd() + "/rssnotify.log"
rssnotify["dont_print_first_message"] = True # prevents spam when restarting the bot/reloading the module
rssnotify["update_cooldown"] = 60 # in seconds
rssnotify["show_commit_link"] = True
rssnotify["use_git.io"] = True
rssnotify["last_update"] = time.time() - rssnotify["update_cooldown"]
def rsscheck(phenny, input):
t = time.time()
if rssnotify["last_update"] > t-rssnotify["update_cooldown"]:
@ -108,6 +108,13 @@ def rsscheck(phenny, input):
chans = feeds[v][1]
else:
print("[RssNotify]: Something went wrong!")
if rssnotify["logfilepath"] != "":
lf = open(rssnotify["logfilepath"], "a")
if commiter.lower() != commiter_realname.lower():
lf.write("[color=#3465a4][Git][/color] [color=#cc0000]%s[/color] ([color=#cc0000]%s[/color]) -> [color=#73d216]%s[/color]: [b]%s[/b] [color=#a04265]%s[/color] %s ([color=#888a85]%s[/color])" % (commiter, commiter_realname, reponame, feed_entry.title, commit_hash, commit_link, commit_time))
else:
lf.write("[color=#3465a4][Git][/color] [color=#cc0000]%s[/color] -> [color=#73d216]%s[/color]: [b]%s[/b] [color=#a04265]%s[/color] %s ([color=#888a85]%s[/color])" % (commiter, reponame, feed_entry.title, commit_hash, commit_link, commit_time))
lf.close()
for ch in chans:
if commiter.lower() != commiter_realname.lower():
phenny.write(['PRIVMSG', ch], "\x0302[Git]\x0f \x0304%s\x0f (\x0304%s\x0f) -> \x0303%s\x0f: \x02%s\x0f \x0313%s\x0f %s (\x0315%s\x0f)" % (commiter, commiter_realname, reponame, feed_entry.title, commit_hash, commit_link, commit_time))