Coder Social home page Coder Social logo

Comments (4)

leonhard-s avatar leonhard-s commented on June 2, 2024

The background polling required to detect the member change requires a scheduled task, which would have to be part of the trigger itself.
This means that triggers must provide a hook to let events register scheduled tasks, which in turn means that the event must be able to register a task. This scheduled task would also need an input for the outfit ID to poll, which must be passed as part of the event definition.

All this combined makes me wonder if we should simplify Triggers to only handle subscriptions, task loops, and filters, with Events being responsible for defining subscriptions or scheduled tasks. This would also tidy up the redundancy of Trigger.conditions and the characters/worlds list in the Trigger initialiser; since the latter would be part of the Event definition (which is nice, since character IDs being available for FacilityControl events made no sense to begin with).

I am not sure if we can (or should) combine the Events passed to Triggers and the Events received by trigger actions into the same object.

from auraxium.

leonhard-s avatar leonhard-s commented on June 2, 2024

The following is an attempt to stick to a single Event object.

We cannot use the auraxium.Event initialiser to pass event-specific data; not without fighting pydantic over the initialiser. An alternative would be to use any variable-length positional arguments as inputs:

@client.trigger(auraxium.OutfitMemberJoin, 1234567890123456)
async def on_member_join(event: auraxium.OutfitMemberJoin) -> None:
    print(f'{event.member_name} joined on {event.membed_joined}')

We could even forward any arguments except for conditions= to the event, that way the current characters/worlds syntax would remain available for the built-in PS2 events:

@client.trigger(auraxium.Death, characters=[...], worlds=[...])
async def on_death(...):
    ...

The biggest difference would happen internally, since Events would need to expose a hook to register them, either by subscriptions or via scheduled tasks that can be attached to a given trigger.

from auraxium.

leonhard-s avatar leonhard-s commented on June 2, 2024

Putting this on hold until #34 is resolved.

from auraxium.

leonhard-s avatar leonhard-s commented on June 2, 2024

Closing as there is no real benefit to modelling this as a pseudo-event rather than a simple scheduled check.

Users wanting to check for outfit joins are advised to just store the list of members in a local file and run a checker at their desired schedule to scan for new members.

from auraxium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.