Open litr0x opened 2 years ago
Could you include an example of what the botcmd you were using to do this? If it's a custom botcmd, would also be able to include a snippet of it?
I have the same issue. My botcmd looks something like this
@arg_botcmd("job_id", type=int, name="get-jenkins-log")
def get_jenkins_log(self, msg, job_id):
try:
to = msg.frm.room
except AttributeError:
to = msg.frm
body = Command.get_jenkins_job_log(job_id)
self.send_stream_request(
user=to,
fsource=BytesIO(
bytes(
body,
"utf-8",
)
),
)
The issue seems to be that to.channelid
contains <#C12345|channel-name>
instead of just C12345
that Slack expects. In my case the fix is changing stream.identifier.channelid
to stream.identifier.id
in _slack_upload
def _slack_upload(self, stream: Stream) -> None:
"""
Performs an upload defined in a stream
:param stream: Stream object
:return: None
"""
try:
stream.accept()
resp = self.slack_web.files_upload(
channels=stream.identifier.id, filename=stream.name, file=stream
)
if resp.get("ok"):
stream.success()
else:
stream.error()
except Exception:
log.exception(f"Upload of {stream.name} to {stream.identifier.channelname} failed.")
i triying to upload a file to a slack chat. This is a complete log