Clean up coroutines/__init__.py

Make a function that returns a lambda to make it clearer what it does.
This commit is contained in:
Robert Miles 2018-11-23 22:10:10 -05:00
parent a28241c718
commit 0d367b0a42
1 changed files with 6 additions and 3 deletions

View File

@ -8,9 +8,12 @@ from coroutines.rss import RSS
# def test(bot):
# print("Testing {}".format(bot.botnick))
def use(cls):
return lambda state: cls(state).start()
coroutines = [
{
"worker": lambda state: BBJ(state).start(),
"worker": use(BBJ),
"interval": 5,
"state": {
"alias": "bbj",
@ -19,7 +22,7 @@ coroutines = [
}
},
{
"worker": lambda state: RSS(state).start(),
"worker": use(RSS),
"interval": 6,
"state": {
"alias": "title",
@ -29,7 +32,7 @@ coroutines = [
}
},
{
"worker": lambda state: RSS(state).start(),
"worker": use(RSS),
"interval": 8,
"state": {
"alias": "links-comments",