slack.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:Slack-Gitsin 作者: yasintoy 项目源码 文件源码
def print_history(self, response, channel_name):
        os.system("clear; figlet '" + channel_name + "' | lolcat")
        response["messages"].reverse()
        text = ""
        for i in response["messages"]:
            if "user" in i:
                text += "\033[31m" + self.find_user_name(i["user"]) + "\033[0m" + "\t\t"
            elif "username" in i:
                text += "\033[31m" + (i["username"].encode('ascii', 'ignore').decode('ascii')) + "\033[0m" + "\t"
            text += "\033[93m" + time.ctime(float(i["ts"])) + "\033[0m" + "\n"
            # replace username_id with username
            if "<@" in i["text"]:
                i["text"] = "<" + i["text"].split("|")[1]
            text += (i["text"].encode('ascii', 'ignore').decode('ascii')) + "\n\n"
            os.system("echo ' " + text + "'")
            text = ""
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号