我使用slackclient和python创建了一个slackbot。它运行得很好。但是,经过一段时间后,我开始从bot收到多条消息。
if self.messages.get(team_id):
self.messages[team_id].update({user_id: message.Message()})
else:
self.messages[team_id] = {user_id: message.Message()}
message_obj = self.messages[team_id][user_id]
message_obj.channel = self.open_dm(user_id)
message_obj.create_attachments()
post_message = self.client.api_call("chat.postMessage",
channel=message_obj.channel,
username=self.name,
icon_emoji=self.emoji,
text=message_obj.text,
attachments=message_obj.attachments
)