etalab-ia / albert-tchap

Bot for Tchap (the messaging app of the French State) using Albert, the French administration Artificial Intelligence agent
MIT License
13 stars 1 forks source link

feat: leave rooms with more than 2 users #43

Open bolinocroustibat opened 6 months ago

bolinocroustibat commented 6 months ago

Draft PR related to https://github.com/etalab-ia/albert-tchapbot/issues/7

nrolin commented 6 months ago

If I'm not mistaken one could invite the bot to a salon, and if the bot is the first (which is likely to be the case if he's invited as the same time as others) to answer he will join and not left.

The matrix client has a list_direct_rooms method, so it shouldn't be that hard to know if it is a direct room or not

nrolin commented 6 months ago

If I'm not mistaken one could invite the bot to a salon, and if the bot is the first (which is likely to be the case if he's invited as the same time as others) to answer he will join and not left.

The matrix client has a list_direct_rooms method, so it shouldn't be that hard to know if it is a direct room or not

After looking at the code, it seems the simpler will be to list the direct message rooms with list_direct_rooms and verify the id of the current room is in. The question is whether the list is updated fast enough