Fix channel list
This commit is contained in:
parent
1099070b5b
commit
f620a13554
6
bot.py
6
bot.py
|
@ -1,4 +1,4 @@
|
|||
import teambot, sys, tasks
|
||||
import teambot, sys, tasks, json
|
||||
import os.path as fs
|
||||
|
||||
class RadioBot(teambot.Handler):
|
||||
|
@ -6,7 +6,7 @@ class RadioBot(teambot.Handler):
|
|||
super(RadioBot,self).__init__(*args)
|
||||
self.tasks = tasks.TaskPool(handler=self)
|
||||
self.tasks.add_coroutine(self.check_nowplaying,1,dict(now_playing="",dj=None))
|
||||
self.channels = [x.split()[0] for x in args[0].channels]
|
||||
self.channels = [x.split()[0] for x in self._bot.chanlist]
|
||||
self.tasks.run()
|
||||
def check_nowplaying(self,state,basestate):
|
||||
with open(fs.expanduser("~ben/public_html/radio/now_playing.txt")) as f:
|
||||
|
@ -16,6 +16,8 @@ class RadioBot(teambot.Handler):
|
|||
if nick.startswith("khuxkm") and text.rstrip()=="!down":
|
||||
self.tasks.stop()
|
||||
self._bot.die("Stopping...")
|
||||
else:
|
||||
self.say(channel,json.dumps(self.channels))
|
||||
|
||||
if __name__=="__main__":
|
||||
if not fs.exists("channels.txt"):
|
||||
|
|
Loading…
Reference in New Issue