Skip to content

Commit

Permalink
fixed build error
Browse files Browse the repository at this point in the history
  • Loading branch information
rking32 committed Jul 2, 2020
1 parent 892f136 commit de58443
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
18 changes: 4 additions & 14 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,14 @@
# All rights reserved.

import os
import asyncio

from userge import userge


async def worker() -> None: # pylint: disable=missing-function-docstring
chat_id = int(os.environ.get("CHAT_ID") or 0)
await userge.send_message(chat_id, 'testing_userge')


async def main() -> None: # pylint: disable=missing-function-docstring
print('starting userge...!')
await userge.begin(worker())
print('stopping userge...!')

loop = asyncio.get_event_loop()
print('creating loop...!')
loop.run_until_complete(main())
print('closing loop...!')
loop.close()

print('userge test has been finished!')
if __name__ == "__main__":
userge.begin(worker())
print('userge test has been finished!')
3 changes: 1 addition & 2 deletions userge/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,11 @@ def begin(self, coro: Optional[Awaitable[Any]] = None) -> None:
loop = asyncio.get_event_loop()
run = loop.run_until_complete
run(self.start())
# print(self.manager.loaded_plugins)
loop = asyncio.get_event_loop()
running_tasks: List[asyncio.Task] = []
for task in self._tasks:
running_tasks.append(loop.create_task(task()))
if coro and asyncio.iscoroutinefunction(coro):
if coro:
_LOG.info(_LOG_STR, "Running Coroutine")
run(coro)
else:
Expand Down

0 comments on commit de58443

Please sign in to comment.