Open torgeirl opened 1 year ago
Had another look at this after upgrading to Errbot 6.2.0, and when attempting to provide card.parent
, as exemplified by @TheJokersThief in #76 ...
@botcmd
def hello(self, msg, args):
"""Say hello to someone"""
return_msg = Card(
to=msg.frm,
title="Hello, world",
parent=msg.parent if msg.parent else None,
)
self._bot.send_card(return_msg)
... I get an error stating that send_card()
doesn't have a parent
keyword argument:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/errbot/core.py", line 574, in _execute_and_send
reply = method(msg, match) if match else method(msg, args)
^^^^^^^^^^^^^^^^^
File "/app/plugins/tradingpost-errbot/tradingpost.py", line 40, in card
self.send_card(title=card['name'],
TypeError: BotPlugin.send_card() got an unexpected keyword argument 'parent'
"
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/errbot/core.py", line 574, in _execute_and_send
reply = method(msg, match) if match else method(msg, args)
^^^^^^^^^^^^^^^^^
File "/app/plugins/tradingpost-errbot/tradingpost.py", line 40, in card
self.send_card(title=card['name'],
TypeError: BotPlugin.send_card() got an unexpected keyword argument 'parent'
Trying to only use card.to
(instead of card.in_reply_to
as instructed in the docs) gives a similar error:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/errbot/core.py", line 574, in _execute_and_send
reply = method(msg, match) if match else method(msg, args)
^^^^^^^^^^^^^^^^^
File "/app/plugins/tradingpost-errbot/tradingpost.py", line 38, in card
self.send_card(title=card['name'],
File "/usr/local/lib/python3.11/site-packages/errbot/botplugin.py", line 654, in send_card
self._bot.send_card(
File "/usr/local/lib/python3.11/site-packages/slackv3/slackv3.py", line 860, in send_card
to_humanreadable, to_channel_id = self._prepare_message(card)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/slackv3/slackv3.py", line 687, in _prepare_message
to_humanreadable = msg.to.username
^^^^^^^^^^^^^^^
AttributeError: 'Message' object has no attribute 'username'
As a side note it seems strange that the default behavior of send_card()
isn't similar to send_message()
: only reply in-thread when prompted in a thread.
Also note that send_card()
and send_stream_request()
have the opposite behavior:
send_message()
replies in either channel or thread (where prompted) :heavy_check_mark: send_card()
always reply in-thread :x: send_stream_request()
always reply in channel :x:
send_card
(andsend_stream_request
) used to not reply in-thread (Errbot #1549), but within the last few monthssend_card
is suddenly only reply in-thread when invoked.As noted by @nzlosh this repo have recently made changes to its
send_card
implimentation: