feat(bot): ✨ Move background tasks to separate image.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import asyncio
|
||||
|
||||
import functools
|
||||
|
||||
import click
|
||||
|
||||
from procs import flush_messages
|
||||
|
||||
from payphone.db import setup
|
||||
from payphone.core import logging
|
||||
|
||||
|
||||
logging.setup("Tasks")
|
||||
|
||||
|
||||
def coroutine(f):
|
||||
@functools.wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
return asyncio.run(f(*args, **kwargs))
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
@click.group()
|
||||
@coroutine
|
||||
async def main():
|
||||
await setup.init()
|
||||
|
||||
|
||||
@main.command()
|
||||
@coroutine
|
||||
async def flush():
|
||||
await flush_messages.flush()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user