SO-ChatBot icon indicating copy to clipboard operation
SO-ChatBot copied to clipboard

bot.isOwner only checks room 17

Open rlemon opened this issue 10 years ago • 8 comments

Now that the bot is in the wild, shouldn't bot.isOwner check the users owner status from the room the command is invoked in?

I've tested this and only owners of room 17 can use use: 'OWNER' commands. Not sure if this is a bug or by design so I'll neglect a label on this one.

rlemon avatar Sep 08 '14 15:09 rlemon

ENOREPRO in Root Access. I don't have owner in your room but I can invoke owner commands in RA.

http://chat.stackexchange.com/transcript/message/17563867#17563867

NOTE: Not sure if this is due to recent changes in Zirak master; I haven't synced my repo over in a while.

allquixotic avatar Sep 08 '14 16:09 allquixotic

Well an owner in the HTML room couldn't run any isOwner checked commands, and I was able to invoke one from the C# room, (which I'm not an owner). Adding the HTML user to the list of owners in the JS room allowed him to use an isOwner checked command.

rlemon avatar Sep 08 '14 16:09 rlemon

Is it the same exact bot instance (Caprica Six) running in all those rooms? My intuition is that a bot instance will check if the user is an owner in the bot's first/primary room, but if you have a separate bot instance (different instance of firefox, or whatever) in each room, this issue won't occur.

allquixotic avatar Sep 08 '14 16:09 allquixotic

one instance of the bot.

rlemon avatar Sep 08 '14 16:09 rlemon

OK, so this is most likely the situation.

Since the users data structure is shared between each room the bot is in, and there's no Map between room and owner flags, the bot literally does not store the data of whether each user is an owner in each of its rooms... so it's a valid defect, it's just being mischaracterized as being a hard-coding of 17 when it's not that at all.

allquixotic avatar Sep 08 '14 16:09 allquixotic

Yeah, this is a bug

SomeKittens avatar Sep 08 '14 19:09 SomeKittens

It's a known issue, stemming from how the bot wasn't meant to be multi-room. Fixing this requires redoing how the bot handles users in general.

Zirak avatar Sep 09 '14 16:09 Zirak

I believe, from running it myself, that a series of users are defined as owners:

  • Those who were or are mods; and
  • Those who own a room the bot has been in.

This can be overridden in several ways. I will describe them if someone asks.

FreezePhoenix avatar Mar 14 '18 18:03 FreezePhoenix