微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何集成光标以检索所有松弛通道名称

如何解决如何集成光标以检索所有松弛通道名称

我正在尝试检索我工作区中的所有空闲频道。我有超过 1000 个频道和对话限制。列表是 1000,它说我必须使用光标才能进入下一页。 如果有人可以帮助我,我对此很陌生,我将非常感激。 提前致谢。强文本

import json
from slack_sdk.web.async_client import AsyncWebClient
from slack_sdk import WebClient
from flask import Flask,request,make_response,jsonify

# WebClient insantiates a client that can call API methods
# When using Bolt,you can use either `app.client` or the `client` passed to listeners.
client = WebClient("xoxb-")
# You probably want to use a database to store any conversations information ;)
conversations_store = {}

def fetch_conversations():
    try:
        # Call the conversations.list method using the WebClient
        result = client.conversations_list()
        save_conversations(result["channels"])
        print(result["response_Metadata"]["next_cursor"])
        if result["response_Metadata"]["next_cursor"] is not None:
    except SlackApiError as e:
        logger.error("Error fetching conversations: {}".format(e))


# Put conversations into the JavaScript object
def save_conversations(conversations):
    conversation_id = ""
    for conversation in conversations:
        # Key conversation info on its unique ID
        conversation_id = conversation["id"]
        print(conversation["name"])
        # Store the entire conversation object
        # (you may not need all of the info)
        conversations_store[conversation_id] = conversation

fetch_conversations()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。