kenkov / kovot

Python Chatbot Framework
MIT License
4 stars 1 forks source link

Do you have a plan to provide ABC for each component of kovot? #12

Closed kazh98 closed 5 years ago

kazh98 commented 5 years ago

Hi @kenkov,

Do you have a plan to provide abstract base classes for each component of kovot such as Mods, Streams, and so on? I think that these provisions make implementing bots and/or customizing kovot dramatically easier.

Thanks.

kenkov commented 5 years ago

Hi kazh98,

Thank you for your suggestion about using base classes with abc.

Currently I think there is not enough reason to adapt abc for Mod or Stream to implement some interface. I believe duck-typing style implementation with interface test is enough now. In the future, there may be some reason to adopt abc to implement something like hook methods. In that time, I consider to use it.

kazh98 commented 5 years ago

Thank you for answering my question. I understand current policy of development!

I'm now considering to make my bot with kovot. Then, I need to prepare specialized Mastodon stream for making it. So, I asked you how should I do it.


けんこふさんのmod_karunabe をMastodon で使ってみたくて、そのために(Mastodon)Stream オブジェクトのfiltering(例えば特定のアカウントからのメンションだけ反応するような) 機能や確率で間引いて返答する機能などのためのAdapter クラスを作ろうと思っていました。

# @risa@social.arnip.org からのメンションを70% の確率で返答
kovot.run(stream=StreamSieve(0.7, StreamFilter('@risa@social.arnip.org', Mastodon(...))))

例えばこのようなときに、StreamSieveStreamFilter は(恐らく)Stream としても利用できる形になると思うので、もしインターフェイスなどが用意される予定があるのであれば、それを想定してコーディングしておこうかなと思って質問しました。

kovot のコーディング方針を教えてくれてありがとうです:-)