errbotio / err-backend-discord

Backend for Discord for Errbot
GNU General Public License v3.0
23 stars 22 forks source link

Requesting examples #46

Closed GrantBirki closed 2 years ago

GrantBirki commented 3 years ago

Hi! I am requesting a few examples to be added to the README.md of this repo.

Send Card

Edit: SOLVED BELOW

Using the errbot backend for Slack you can do something like this:

self.send_card(
    title='Hey!',
    body='Some body here',
    image='https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png', # a url to an image
    color='red',
    in_reply_to=msg
)

Send Image

Edit: STILL UNRESOLVED

How can one send an image as a response with the Discord backend? Not just sending a URL/link (to an image) but rather actually uploaded an image to Discord as a user would do.

It would be nice to have some docs around how to do these common responses with the Discord backend

Thanks!

GrantBirki commented 3 years ago

Another note, when trying to use the self.send_card() function I get this response:

self.send_card(
    title='Hey!',
    body='Some body here',
    in_reply_to=msg
)

Errbot error:

Computer says nooo. See logs for details:
invalid literal for int() with base 16: 'green'
GrantBirki commented 3 years ago

Another note, when trying to use the self.send_card() function I get this response:

self.send_card(
    title='Hey!',
    body='Some body here',
    in_reply_to=msg
)

Errbot error:

Computer says nooo. See logs for details:
invalid literal for int() with base 16: 'green'

I found the solution to the item above. I needed to specify a hex code for the color like so:

self.send_card(
    title='Hey!',
    body='Some body here',
    color='#000000'.
    in_reply_to=msg
)