Closed webpigeon closed 8 months ago
I didn't design errbot and I agree having an abstract base class that defines nothing does make for a weak API contract. I took a look at other backends and most use multiple inheritance of Person
and RoomOccupant
, however this probably only makes sense in the context of how the particular backend actually functions.
I did find a couple of exceptions to the multiple inheritance:
The Identifer
class was added with this commit.
Author: Guillaume Binet <gbin@google.com>
Date: Mon Nov 9 14:42:28 2015 -0500
Materialized Identifier and MUCIdentifier as ABC
With type hinting on the API surface, it makes more sense now to
materialize the Identifiers so users can autocomplete/explore them.
When committed, it had the following method: person
, client
, nick
, aclattr
, fullname
.
A later commit removed all methods
commit b9ae4d06ed9668694ce5ea54580acd2f0b412c04
Author: Guillaume Binet <gbin@google.com>
Date: Fri Mar 4 16:10:44 2016 -0800
big rename, still some failing cases.
The methods removed from Identifier
are all part of the Person
class.
From the examples I've seen, I'd recommend using multiple inheritance and if that causes crashes in the plugin, try to investigate what underlying assumptions in the code aren't compatible with that backend and try work around it. I hope that helps.
Thanks very much, based on that I was able to get my Matrix backend working (it also has reaction support now :)).
In order to let us help you better, please fill out the following fields as best you can:
I am...
I am running...
Issue description
The contract for an an 'Identifier' needs is poorly defined. The
RoomOccupant
class ( https://errbot.readthedocs.io/en/latest/_modules/errbot/backends/base.html#RoomOccupant ), only defines one method as being required (room). The description states it should return the full name (which I'm a little confused about, but I'm assuming it wants the room ID).ErrBot core throws an exception if there isn't a
person
method present:The error message states that identifiers need to have a
person
property, this is incorrect as the documentation also states (and implements) that rooms are Identifiers, which clearly doesn't have aperson
property. The identifier also doesn't have an abstract method calledperson
or make any reference to it (butPerson
does).We've used errbot for a long time and we're really impressed with what it can do, I'm more than happy to submit a PR with documentation fixes, I just don't know what the requirements are :).
So, my questions are:
Identifier
and aRoomOccupant
?RoomOccupant
asfrm
(I was passing aPerson
but then the chatroom plugin crashes if it's a public room)?