yiisoft-contrib / ircbot

An IRC bot for the #yii channel on freenode.
GNU General Public License v3.0
4 stars 1 forks source link

The bot does not include Events #2

Open cebe opened 8 years ago

cebe commented 8 years ago

There should be a reaction to:

(17:42:57) CeBe: Application::EVENT_BEFORE_ACTION

but it seems events are not imported from apidoc: https://github.com/yiisoft-contrib/ircbot/blob/master/yii2docbot.js#L39-L82

tom-- commented 8 years ago

The JSON output of yii2-apidoc (example below) has what we need so it can be done probably without too much difficulty.

Do all events look like class constants beginning EVENT_?

Are all class class constants in the framework and core extensions beginning EVENT_ Yii events?

If both are yes then I think the job is fairly easy.

"yii\\base\\Application": {
    "parentClass": "yii\\base\\Module",
    "isAbstract": true,
    "isFinal": false,
    "interfaces": [
        "yii\\base\\Configurable"
    ],
    "traits": [],
    "subclasses": [
        "yii\\console\\Application",
        "yii\\web\\Application"
    ],
    "events": {
        "EVENT_BEFORE_ACTION": {
            "type": "\\yii\\base\\ActionEvent",
            "types": [
                "\\yii\\base\\ActionEvent"
            ],
            "definedBy": "yii\\base\\Module",
            "value": "'beforeAction'",
            "phpDocContext": {},
            "name": "EVENT_BEFORE_ACTION",
            "sourceFile": null,
            "startLine": 44,
            "endLine": 44,
            "shortDescription": "An event raised before executing a controller action.",
            "description": "An event raised before executing a controller action.\nYou may set [[ActionEvent::isValid]] to be false to cancel the action execution.",
            "since": null,
            "deprecatedSince": null,
            "deprecatedReason": null,
            "tags": []
        },
        "EVENT_AFTER_ACTION": {
            "type": "\\yii\\base\\ActionEvent",
            "types": [
                "\\yii\\base\\ActionEvent"
            ],
            "definedBy": "yii\\base\\Module",
            "value": "'afterAction'",
            "phpDocContext": {},
            "name": "EVENT_AFTER_ACTION",
            "sourceFile": null,
            "startLine": 48,
            "endLine": 48,
            "shortDescription": "An event raised after executing a controller action.",
            "description": "An event raised after executing a controller action.",
            "since": null,
            "deprecatedSince": null,
            "deprecatedReason": null,
            "tags": []
        },
cebe commented 8 years ago

Do all events look like class constants beginning EVENT_?

Are all class class constants in the framework and core extensions beginning EVENT_ Yii events?

yes