如何在Golang中制作一个具有动态插件和适配器的聊天机器人?

huangapple go评论89阅读模式
英文:

How to make a chatbot in Golang with dynamic plugins and adapters?

问题

我是新手学习 Golang,并且正在编写一个聊天机器人作为练习。

基本上,我正在使用 net/http 和 gorilla/mux 来处理请求。

目前,它只能与一个特定的聊天平台进行对话(我称之为适配器),并且只有一个插件(在谷歌上查找图片)。

我应该如何使适配器和插件都具有动态性,以便其他开发人员可以编写自己的内容并将我的机器人作为基础平台使用?有没有好的示例?

另外,我应该将所有的插件和适配器放在一个仓库/静态二进制文件中,还是应该将它们分开?我知道两种方式都可以,但你会推荐哪种方式以便更容易进行协作和扩展性?

英文:

I'm new to Golang and writing a chat bot as an exercise.

Basically I'm using net/http and gorilla/mux to handle requests.

For now it can only talk to one specific chat platform (I call it an adapter) and has only one plugin (find a picture on google).

How can I make both adapters and plugins be dynamic - so other developers can write their own stuff and just use my bot as a base platform? Are there any good examples?

Also should I have all the plugins and adapters in one repo/static binary or should they be separate? I know I can do both ways but what would you recommend as a better way to have easier collaboration and extensibility?

答案1

得分: 1

《Medium帖子,“标准包布局”》(https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1),作者是Ben Johnson,这篇文章帮助我思考了这个问题。

英文:

Medium post, "Standard Package Layout", by Ben Johnson, helped me think about this.

huangapple
  • 本文由 发表于 2017年6月2日 03:10:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/44315339.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定