cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Add function to immediately change topic #205

Closed Cysioland closed 9 years ago

Cysioland commented 9 years ago

The #103 got rejected, because you can sort of change topic with setting the topic attribute. But then, you need to wait until attributes get synced to make your changes appear, or you need to do Channel.sync("topic", "new topic"). I want you to reconsider that, pleeeease.

dominikh commented 9 years ago

When changing the topic, a message has to be sent to the server and processed by the server. When the message will be sent depends on rate limiting/message queues. If we changed our internal representation of a channel before the server actually changed the topic, we'd be returning incorrect data.

Cysioland commented 9 years ago

@dominikh Doesn't change the fact, that the topic isn't changed immediately. Is there no way to force bot to change the topic immediately after calling the command?

dominikh commented 9 years ago

No. All message sending goes through the same rate limiting logic, to avoid sending too many messages in a too short timeframe, which would get the bot kicked from the server.

dominikh commented 9 years ago

This has nothing to do with synchronisation, and calling Channel#sync won't change this, either. The moment you call Channel#topic=, a message will be queued. When that message will be sent depends on how many other messages are being sent at the moment.

Cysioland commented 9 years ago

@dominikh So we need a way to force immediate topic change, on the responsibility of a bot hoster. I don't care, if I get booted from my server, it's only my problem, I don't want to be restrained by a freakin' framework!

dominikh commented 9 years ago

Then don't use the freaking framework. Plenty of libraries provide no rate limiting whatsoever, and I'm sure some even make it optional.

As for Cinch, this is not a feature I am currently considering. You can theoretically disable/circumvent the rate limiting by setting the "messages_per_second" option to a very high value. But this will apply to all messages, not just channel topic changes. I'm not intending to add more APIs to make the rate limiting selective.