使用斜杠命令更改Slack bot名称/图像?

2024-04-25 00:29:57 发布

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

我用斜杠命令设置一个slackbot,根据API,你可以通过username来设置bot的用户名。当我尝试它时,名称不会更新。这与斜杠命令的工作方式不一样吗?在

from bottle import run, post, request
@post('/hello')
def hello():
    mydict = request.forms.get('text')
    response = {
    "username": "test",
    "response_type": "in_channel",
    "text": "Greetings!"
        }
    return response

马特【上午11:00】 /你好

MyBot应用程序[11:00 AM] 问候语!在


Tags: textfrom命令名称apihelloresponserequest
1条回答
网友
1楼 · 发布于 2024-04-25 00:29:57

正确。您不能更改在响应类似请求时显示在Slack上的应用程序的名称。它将始终显示您在应用程序设置中配置的名称。在

但是,对于您的用例有一个解决方法:您可以使用chat.postMessage将消息发送到channel/中的用户,这将允许您指定一个自定义用户名和图标,而不是直接回复收到的请求。在

相关问题 更多 >