Skip to content

Avoid exposing attributes as optional if they shouldn't need checking. #134

Open
@wookie184

Description

@wookie184

Users should not need to check that BotBase.stats is not None every time they try to use it, as it never should be None.

We can avoid this by internally using a BotBase._stats attribute that can be None, and exposing a stats property that raises an error if BotBase._stats is None, and otherwise returns the stats client.

I think we should also do this for BotBase.api_client. Whilst it is a slightly different case in that it can be None, it should either always be None or never be None, so the same reasoning applies. If it's always None it makes no sense to access it anyway and it should raise an error.

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