structio/tests/smart_events.py

18 lines
412 B
Python

import structio
@structio.on_event("on_message")
async def test(evt, *args, **kwargs):
print(f"[test] New event {evt!r} with arguments: {args}, {kwargs}")
# Simulate some work
await structio.sleep(1)
async def main():
print(f"[main] Firing two events, exiting in two seconds")
await structio.emit("on_message", 1, 2, 3)
await structio.emit("on_message", 1, 2, 4)
structio.run(main)