slack.py 文件源码

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

项目:foremast 作者: gogoair 项目源码 文件源码
def post_slack_message(message=None, channel=None, username=None, icon_emoji=None):
    """Format the message and post to the appropriate slack channel.

    Args:
        message (str): Message to post to slack
        channel (str): Desired channel. Must start with #

    """
    LOG.debug('Slack Channel: %s\nSlack Message: %s', channel, message)
    slack = slacker.Slacker(SLACK_TOKEN)
    try:
        slack.chat.post_message(channel=channel, text=message, username=username, icon_emoji=icon_emoji)
        LOG.info('Message posted to %s', channel)
    except slacker.Error:
        LOG.info("error posted message to %s", channel)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号