An universal wrapper (and useful tool) to make event / commands in python
Project description
easy-events
A library that help you to manage events
Getting started
Installation
pip install easy-events
GitHub : Github
Usages
text
Code example
from easy_events import Events
# create an event or use it in a class
client = Events()
# create another event
# you can put as much parameters as you want
@client.event("test1")
def test(data, arg1, arg2, *, arg3):
# data is the default parameter, it contain some basic informations that you can format as you want
print(data, arg1, arg2, arg3)
# trigger the event
# dict way
client.trigger({"event": "test1", "parameters": {"arg1": "arg1", "arg2": "arg2", "arg3": ["arg3", "arg4"]}})
# dict way v2
client.trigger({"event": "test", "parameters": ["arg1", "arg2", "arg3", "arg4"]})
# dict way v3
client.trigger({"event": "test1", "parameters": "arg1 arg2 arg3 arg4"})
# list way
client.trigger(["test", "arg1", "arg2", "arg3", "arg4"])
# str way
client.trigger("test arg1 arg2 arg3 arg4")
# the result will be (for all cases):
# arg1 = arg1
# arg2 = arg2
# arg3 = [arg3, arg4]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
easy-events-2.5.2.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for easy_events-2.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de43cc9dc9cbb3fc4942fb97055231b60557be1a6cad6fe3530fce84d0e0f8fc |
|
MD5 | 73dd35b6ce5f41e7a8dc3396c8a4c1d0 |
|
BLAKE2b-256 | a9e91f811daf5c6a1dfc6d2d8942ea148c628850379c8093480722beaf69568c |