Add #team back to channel list, add more channels, add logging facilities and temporarily remove github API while I try and figure out what's happening

This commit is contained in:
Robert Miles 2018-07-23 23:13:26 -04:00
parent 79c39759cc
commit 843cd0a2de
1 changed files with 15 additions and 6 deletions

21
bot.py
View File

@ -4,9 +4,14 @@ import irc.bot
import gitea, github
import markovuniverse as mu
import tvdb_keys,tvdb_api
import os.path
def log(s):
with open(os.path.expanduser("~/minerbot2.log"),"a") as f:
f.write(s.rstrip()+"\n")
gttapi = gitea.GiteaAPI("https://git.tilde.team")
ghapi = github.GithubAPI()
#ghapi = github.GithubAPI()
tvdb = tvdb_api.Tvdb(apikey=tvdb_keys.api_key,cache=False)
def pad(l,n):
@ -23,7 +28,7 @@ class TVBot(irc.bot.SingleServerIRCBot):
self.command_handlers = {}
self.register("prefix",self.setPrefix)
self.register("gitea",self.giteaCommand)
self.register("github",self.githubCommand)
# self.register("github",self.githubCommand)
self.register("quit",self.quitCommand)
self.register("reload",self.reloadCommand)
self.register("su",self.suCommand)
@ -109,7 +114,7 @@ class TVBot(irc.bot.SingleServerIRCBot):
try:
issue_data.raise_for_status()
except Exception as e:
print(e)
log(e)
else:
issue_data = issue_data.json()
descriptor = "Issue"
@ -140,8 +145,8 @@ class TVBot(irc.bot.SingleServerIRCBot):
def giteaCommand(self,c,e,p):
self.gitCommand(gttapi,c,e,p)
def githubCommand(self,c,e,p):
self.gitCommand(ghapi,c,e,p,False)
# def githubCommand(self,c,e,p):
# self.gitCommand(ghapi,c,e,p,False)
def register(self,cmd,func):
self.command_handlers[cmd]=func
@ -166,8 +171,12 @@ class TVBot(irc.bot.SingleServerIRCBot):
if __name__ == '__main__':
channels = [
# '#team',
'#team',
'#meta',
'#quotes',
'#lcpp',
'#journal',
'#sudoers'
]
bot = TVBot(channels, 'minerbot2', 'localhost')
bot.start()