首页 \ 问答 \ Facebook Messenger bot使用Spring Boot?(Facebook Messenger bot using Spring Boot?)

Facebook Messenger bot使用Spring Boot?(Facebook Messenger bot using Spring Boot?)

如今,正在创建越来越多的聊天机器人,因为如果您激活Facebook开发者帐户,并且为此目的创建Facebook页面,则该过程相对容易。

可能最流行的方法是使用NodeJS - Heroku ,如下文所述:

https://chatbotslife.com/how-to-make-a-facebook-messenger-chat-bot-in-1hr-af6bec5e7aec#.xqgu2lb46

经过研究后,我发现通过Spring启动可以与facebook建立连接(如下所述: https//spring.io/guides/gs/accessing-facebook/ )但我没有找到任何信息或 - 甚至类似于NodeJS - 使用Spring Boot服务器处理信使对话的方法。

可以从Spring Boot请求并发送facebook messenger消息吗? 我更喜欢NodeJS,因为我已经在Spring Boot中构建了一个系统,并且在那里集成这个功能比创建一个新服务要容易得多,然后将新服务连接到现有服务。 (即使在某些情况下我肯定会坚持'微服务'结构。)


Nowadays more and more chat bots are being created, as the process is relatively easy if you activate a facebook developer account, and create a facebook page for this purpose.

Probably the most popular method is to using NodeJS - Heroku, as it is explained in the following article:

https://chatbotslife.com/how-to-make-a-facebook-messenger-chat-bot-in-1hr-af6bec5e7aec#.xqgu2lb46

After a research I found that making connection with facebook IS possible via Spring boot (as explained here: https://spring.io/guides/gs/accessing-facebook/ ) but I have not found any information or - even similar to the NodeJS - method to handle a messenger conversation using a Spring Boot server.

Is it possible to request and send facebook messenger messages from Spring Boot? I would prefer that over NodeJS, as I have a system already built in Spring Boot, and it would be much easier to integrate this feature there, than creating a new service, which would be then connected to the existing one. (even if in some cases I definitely would stuck with the 'microservice' structure.)


原文:https://stackoverflow.com/questions/41960379
更新时间:2023-11-06 13:11

最满意答案

你可以使用subplot2grid

import numpy as np
import matplotlib.pyplot as plt

box = dict(facecolor='yellow', pad=5, alpha=0.2)

fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)


# ax1 = fig.add_subplot(221)
ax1 = plt.subplot2grid((3,2), (0,0))
ax1.plot(2000*np.random.rand(10))
ax1.set_title('ylabels not aligned')
ax1.set_ylabel('misaligned 1', bbox=box)
ax1.set_ylim(0, 2000)

# ax3 = fig.add_subplot(223)
ax3 = plt.subplot2grid((3,2), (1,0))
ax3.set_ylabel('misaligned 2',bbox=box)
ax3.plot(np.random.rand(10))


labelx = -0.3  # axes coords

# ax2 = fig.add_subplot(222)
ax2 = plt.subplot2grid((3,2), (0,1))
ax2.set_title('ylabels aligned')
ax2.plot(2000*np.random.rand(10))
ax2.set_ylabel('aligned 1', bbox=box)
ax2.yaxis.set_label_coords(labelx, 0.5)
ax2.set_ylim(0, 2000)

# ax4 = fig.add_subplot(224)
ax4 = plt.subplot2grid((3,2), (1,1))
ax4.plot(np.random.rand(10))
ax4.set_ylabel('aligned 2', bbox=box)
ax4.yaxis.set_label_coords(labelx, 0.5)

ax5 = plt.subplot2grid((3,2), (2,0), colspan=2)
ax5.plot(np.random.rand(10))
ax5.set_ylabel('misaligned 3', bbox=box)

plt.show()

在此处输入图像描述


You could use subplot2grid:

import numpy as np
import matplotlib.pyplot as plt

box = dict(facecolor='yellow', pad=5, alpha=0.2)

fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)


# ax1 = fig.add_subplot(221)
ax1 = plt.subplot2grid((3,2), (0,0))
ax1.plot(2000*np.random.rand(10))
ax1.set_title('ylabels not aligned')
ax1.set_ylabel('misaligned 1', bbox=box)
ax1.set_ylim(0, 2000)

# ax3 = fig.add_subplot(223)
ax3 = plt.subplot2grid((3,2), (1,0))
ax3.set_ylabel('misaligned 2',bbox=box)
ax3.plot(np.random.rand(10))


labelx = -0.3  # axes coords

# ax2 = fig.add_subplot(222)
ax2 = plt.subplot2grid((3,2), (0,1))
ax2.set_title('ylabels aligned')
ax2.plot(2000*np.random.rand(10))
ax2.set_ylabel('aligned 1', bbox=box)
ax2.yaxis.set_label_coords(labelx, 0.5)
ax2.set_ylim(0, 2000)

# ax4 = fig.add_subplot(224)
ax4 = plt.subplot2grid((3,2), (1,1))
ax4.plot(np.random.rand(10))
ax4.set_ylabel('aligned 2', bbox=box)
ax4.yaxis.set_label_coords(labelx, 0.5)

ax5 = plt.subplot2grid((3,2), (2,0), colspan=2)
ax5.plot(np.random.rand(10))
ax5.set_ylabel('misaligned 3', bbox=box)

plt.show()

enter image description here

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)