GreenWall

GreenWall

1M Downloads

[1.7-beta] APIDispatcher never gets called

ashayo opened this issue ยท 1 comments

commented

APIDispatcher never gets called in Channel.lua

In GwChannel:receive
if sender ~= gw.player and guild_id ~= gw.config.guild_id
should probably be something like
if sender ~= gw.player and guild_id ~= gw.config.guild_id and type ~= GW_MTYPE_EXTERNAL

commented

Another good catch. We don't want to combine the alternative clauses, but the ordering is wrong.

        if sender ~= gw.player and guild_id ~= gw.config.guild_id then
            -- Process the chat message
            gw.Debug(GW_LOG_NOTICE, 'channel=%d, type=%d, sender=%s, guild=%s, message=%s',
                    self.number, type, sender, guild_id, message)
            return f(type, guild_id, content, {...})
        elseif type == GW_MTYPE_EXTERNAL then
            -- Handle the API traffic
            local addon, api_message = unpack(content)
            if addon ~= nil and api_message ~= nil then
                gw.APIDispatcher(addon, sender, api_message)
            end
        end

The check for external messages should go first.