Discord Integration Option

Review Request #11201 — Created Sept. 24, 2020 and updated

hailan
rbintegrations
master
rbintegrations, students

Added a Discord Integration option.
This allows Review Board to have an option of notifying Discord channels on
any Review Request changes. This commit also includes a refactoring of the
notify() function in SlackIntegration.

Added unit tests in discord/tests.py and they pass in RB3. RB4 has two
exceptions (please see below).
Please also see my RB4 Discrod Integration demo at
https://www.youtube.com/watch?v=vKY1b60UkmA&ab_channel=ReviewBoard
I've also tested it manually in RB3.

Issues that still need to be addressed:

  • Add assets (e.g. logos, trophies, etc.) at this location:
    https://static.reviewboard.org/integration-assets/discord

  • Delete lines 67 and 68 in discord/integrations.py after Review Request #11211
    is pushed

  • It has the same problem as the Slack and Mattermost Integration:
    two of the unit tests are complaining about this image here in RB4 -
    /var/folders/f1/r8mpbfkd321804b47_tgytgw0000gn/T/rb-tests-EQOxMU/
    static/rb/images/logo.png

Summary Author
Discord Chat Integration
HailanXyouknow
Loading file attachments...

Description From Last Updated

E261 at least two spaces before inline comment

reviewbotreviewbot

E262 inline comment should start with '# '

reviewbotreviewbot

E261 at least two spaces before inline comment

reviewbotreviewbot

E262 inline comment should start with '# '

reviewbotreviewbot

Please remove.

MarcusBoayMarcusBoay

TODO comment?

MarcusBoayMarcusBoay

Should this be Discord instead?

MarcusBoayMarcusBoay

Should this be Discord instead?

MarcusBoayMarcusBoay

Should this be Discord instead?

MarcusBoayMarcusBoay

Should this be Discord instead?

MarcusBoayMarcusBoay

It's more of a nitpick but 'mattemost' -> 'discord'

MarcusBoayMarcusBoay

Let's use double quotes for the quotation marks inside the string.

daviddavid

Please add a blank line between these two.

daviddavid

Maybe move the contents of this method back into the integration class? I don't see a good reason to have ...

daviddavid

Please use single quotes for these.

daviddavid

Can we use a named logger here? At the top level of the file, add: logger = logging.getLogger(__name__) This can ...

daviddavid

There's an extra blank line here that can be removed.

daviddavid

Please add a module docstring to the top of this file.

daviddavid

Add a blank line between these two.

daviddavid

Leftover debug output?

daviddavid

This line isn't necessary.

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

hailan
Review request changed

Change Summary:

Using Slack's format for Discord webhook messages. It looks cleaner
this way - we don't need to do weird things like translating hex
color code to decimal numbers

Description:

~  

Looks like this right now.

~   Still trying to figure out how to pass in all the relevant fields.
~   Image

  ~

Admins can add a Discord Integration to their Review Board. After

  ~ setting it up, it will alert them on the changes of Review Request
  ~ in the specified Discord Server.

Commits:

Summary Author
-
Discord Chat Integration
HailanXyouknow
+
Discord Chat Integration
HailanXyouknow

Diff:

Revision 2 (+662 -38)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

hailan
hailan
hailan
  1. 
      
  2. 
      
hailan
MarcusBoay
  1. 
      
  2. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    Please remove.

  3. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    TODO comment?

  4. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    Should this be Discord instead?

  5. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    Should this be Discord instead?

    1. I've added an explanation on why this it is using Slack's URL. :)

  6. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    Should this be Discord instead?

  7. rbintegrations/discord/integration.py (Diff revision 4)
     
     

    Should this be Discord instead?

  8. rbintegrations/discord/tests.py (Diff revision 4)
     
     

    It's more of a nitpick but 'mattemost' -> 'discord'

  9. 
      
hailan
hailan
Review request changed

Change Summary:

Added Discord icons

Added Files:

david
  1. Looking pretty solid. Just some style-related comments.

  2. rbintegrations/discord/forms.py (Diff revision 5)
     
     
     
     

    Let's use double quotes for the quotation marks inside the string.

  3. rbintegrations/discord/integration.py (Diff revision 5)
     
     
     

    Please add a blank line between these two.

  4. rbintegrations/discord/integration.py (Diff revision 5)
     
     
     
     

    Maybe move the contents of this method back into the integration class? I don't see a good reason to have a separate top-level function here.

  5. rbintegrations/discord/integration.py (Diff revision 5)
     
     
     

    Please use single quotes for these.

  6. rbintegrations/discord/integration.py (Diff revision 5)
     
     

    Can we use a named logger here? At the top level of the file, add:

    logger = logging.getLogger(__name__)
    

    This can then be logger.debug(...)

  7. rbintegrations/discord/integration.py (Diff revision 5)
     
     

    There's an extra blank line here that can be removed.

  8. rbintegrations/discord/tests.py (Diff revision 5)
     
     

    Please add a module docstring to the top of this file.

  9. rbintegrations/discord/tests.py (Diff revision 5)
     
     
     

    Add a blank line between these two.

  10. rbintegrations/discord/tests.py (Diff revision 5)
     
     
     

    Leftover debug output?

  11. rbintegrations/slack/integration.py (Diff revision 5)
     
     

    This line isn't necessary.

  12. 
      
Loading...