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:
parent
79c39759cc
commit
843cd0a2de
21
bot.py
21
bot.py
|
@ -4,9 +4,14 @@ import irc.bot
|
||||||
import gitea, github
|
import gitea, github
|
||||||
import markovuniverse as mu
|
import markovuniverse as mu
|
||||||
import tvdb_keys,tvdb_api
|
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")
|
gttapi = gitea.GiteaAPI("https://git.tilde.team")
|
||||||
ghapi = github.GithubAPI()
|
#ghapi = github.GithubAPI()
|
||||||
tvdb = tvdb_api.Tvdb(apikey=tvdb_keys.api_key,cache=False)
|
tvdb = tvdb_api.Tvdb(apikey=tvdb_keys.api_key,cache=False)
|
||||||
|
|
||||||
def pad(l,n):
|
def pad(l,n):
|
||||||
|
@ -23,7 +28,7 @@ class TVBot(irc.bot.SingleServerIRCBot):
|
||||||
self.command_handlers = {}
|
self.command_handlers = {}
|
||||||
self.register("prefix",self.setPrefix)
|
self.register("prefix",self.setPrefix)
|
||||||
self.register("gitea",self.giteaCommand)
|
self.register("gitea",self.giteaCommand)
|
||||||
self.register("github",self.githubCommand)
|
# self.register("github",self.githubCommand)
|
||||||
self.register("quit",self.quitCommand)
|
self.register("quit",self.quitCommand)
|
||||||
self.register("reload",self.reloadCommand)
|
self.register("reload",self.reloadCommand)
|
||||||
self.register("su",self.suCommand)
|
self.register("su",self.suCommand)
|
||||||
|
@ -109,7 +114,7 @@ class TVBot(irc.bot.SingleServerIRCBot):
|
||||||
try:
|
try:
|
||||||
issue_data.raise_for_status()
|
issue_data.raise_for_status()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
log(e)
|
||||||
else:
|
else:
|
||||||
issue_data = issue_data.json()
|
issue_data = issue_data.json()
|
||||||
descriptor = "Issue"
|
descriptor = "Issue"
|
||||||
|
@ -140,8 +145,8 @@ class TVBot(irc.bot.SingleServerIRCBot):
|
||||||
def giteaCommand(self,c,e,p):
|
def giteaCommand(self,c,e,p):
|
||||||
self.gitCommand(gttapi,c,e,p)
|
self.gitCommand(gttapi,c,e,p)
|
||||||
|
|
||||||
def githubCommand(self,c,e,p):
|
# def githubCommand(self,c,e,p):
|
||||||
self.gitCommand(ghapi,c,e,p,False)
|
# self.gitCommand(ghapi,c,e,p,False)
|
||||||
|
|
||||||
def register(self,cmd,func):
|
def register(self,cmd,func):
|
||||||
self.command_handlers[cmd]=func
|
self.command_handlers[cmd]=func
|
||||||
|
@ -166,8 +171,12 @@ class TVBot(irc.bot.SingleServerIRCBot):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
channels = [
|
channels = [
|
||||||
# '#team',
|
'#team',
|
||||||
'#meta',
|
'#meta',
|
||||||
|
'#quotes',
|
||||||
|
'#lcpp',
|
||||||
|
'#journal',
|
||||||
|
'#sudoers'
|
||||||
]
|
]
|
||||||
bot = TVBot(channels, 'minerbot2', 'localhost')
|
bot = TVBot(channels, 'minerbot2', 'localhost')
|
||||||
bot.start()
|
bot.start()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user