简体   繁体   English

使用斜杠命令更改Slack机器人名称/图像?

[英]Changing Slack bot name / image using Slash Commands?

I'm setting up a slackbot with slash commands and according to API you're able to pass username to set the username of a bot. 我正在使用斜杠命令设置slackbot,根据API,您可以传递用户名来设置机器人的用户名。 When I try it, the name does not update. 尝试时,名称不会更新。 Does this not work with slash commands in the same way that it does with bots? 斜线命令不能像机器人一样使用斜杠命令吗?

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

matt [11:00 AM] /hello 马特[11:00 AM] /您好

MyBot APP [11:00 AM] Greetings! MyBot APP [11:00 AM]问候!

Correct. 正确。 You can not change the name of the app that appears on Slack when you respond to a request like that. 当您响应这样的请求时,您无法更改出现在Slack上的应用程序的名称。 It will always show the name you configured in the app settings. 它将始终显示您在应用设置中配置的名称。

However, there is a workaround for your use case: Instead of replying to the received request directly you can send a message into the channel / to the user with chat.postMessage , which will allow you to specify a custom username and icon. 但是,您的用例有一个解决方法:您可以使用chat.postMessage将消息发送到channel /中,而不是直接答复收到的请求,从而可以指定自定义用户名和图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM