Skip to content

Needs to use static instance of sisbase bot to access a system from a command. #3

Description

@alikindsys

This is an oversight and an antipattern. The library should integrate the systems using DI seamlessly on SisbaseCommandContext.

It has been discussed countless times, and its a core tenant of the rewrite : to make this version static-less.
Considering cnext::UsesAttribute would stop command execution in case of an unexistent system, and its static-less, doing this should be possible.
As it currrently stands this is the only way to feasibly get a system.

[Uses(typeof(System))]
class CommandClass : ModuleBase<SisbaseCommandContext>  { 
    //Static instance of a sisbase bot stored on the main class. EEEW.
    System s = Program.botInstance.Systems.Get<System>();
}

The idea is to somehow integrate that into SCCTX's funcionality so that DI itself would make it seamless.

[Uses(typeof(System))]
class CommandClass : ModuleBase<SisbaseCommandContext>  { 
    //`s` gets injected using di. nice.
    System s;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions