Make some things easier for me
parent
7fd2115116
commit
31548dd090
11
rssnotify.py
11
rssnotify.py
|
@ -6,6 +6,7 @@ Copyright 2013, sfan5
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import web
|
import web
|
||||||
|
import os
|
||||||
import feedparser # sudo pip install feedparser
|
import feedparser # sudo pip install feedparser
|
||||||
rssnotify = {}
|
rssnotify = {}
|
||||||
|
|
||||||
|
@ -29,14 +30,13 @@ def excepta(arr, exclude):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
rssnotify["last_updated_feeds"] = {}
|
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["dont_print_first_message"] = True # prevents spam when restarting the bot/reloading the module
|
||||||
rssnotify["update_cooldown"] = 60 # in seconds
|
rssnotify["update_cooldown"] = 60 # in seconds
|
||||||
rssnotify["show_commit_link"] = True
|
rssnotify["show_commit_link"] = True
|
||||||
rssnotify["use_git.io"] = True
|
rssnotify["use_git.io"] = True
|
||||||
rssnotify["last_update"] = time.time() - rssnotify["update_cooldown"]
|
rssnotify["last_update"] = time.time() - rssnotify["update_cooldown"]
|
||||||
|
|
||||||
|
|
||||||
def rsscheck(phenny, input):
|
def rsscheck(phenny, input):
|
||||||
t = time.time()
|
t = time.time()
|
||||||
if rssnotify["last_update"] > t-rssnotify["update_cooldown"]:
|
if rssnotify["last_update"] > t-rssnotify["update_cooldown"]:
|
||||||
|
@ -108,6 +108,13 @@ def rsscheck(phenny, input):
|
||||||
chans = feeds[v][1]
|
chans = feeds[v][1]
|
||||||
else:
|
else:
|
||||||
print("[RssNotify]: Something went wrong!")
|
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:
|
for ch in chans:
|
||||||
if commiter.lower() != commiter_realname.lower():
|
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))
|
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))
|
||||||
|
|
Loading…
Reference in New Issue