Slack python bot对来自对话列表()的所有通道中的新消息执行操作

2024-09-28 22:20:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个pythonslack-client应用程序

from slack import RTMClient

@RTMClient.run_on(event="message")
def say_hello(**payload):
  print('hello')

token = ''
rtm_client = RTMClient(token=token)

我要它做的是print ('hello')通过以下方式对每个可用通道中的每个新消息执行操作:

client = slack.WebClient(token=token)
channels = client.conversations_list()

不过,目前我只能print在我的bot加入的通道中添加新消息。有办法吗


Tags: runfromimportclienttokenevent应用程序消息