我想编写一个简单的slack机器人程序,它响应给定的字符串@references,但是我无法使官方文档代码正常工作
我向bot授予了所有OAuth权限,并拥有以下代码:
from slack import RTMClient
@RTMClient.run_on(event="message")
def gravity_bot(**payload):
data = payload['data']
print(data.get('text'))
try:
rtm_client = RTMClient(
token="my_token_auth_code",
connect_method='rtm.start'
)
print("Bot is up and running!")
rtm_client.start()
except Exception as err:
print(err)
我认为连接已经建立,因为出现了“Bot已启动并运行”消息,但是在空闲通道上,到Bot的连接似乎处于脱机状态,而且我无法在终端中获得任何响应,无法获得直接消息,甚至在邀请Bot到给定通道后也无法获得通道消息
对不起,我不能让这件事过去。。我找到了答案,以下是步骤:
先前的答案:
相关问题 更多 >
编程相关推荐