Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for slack events #1451

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
9555627
Initial support for slack events
AgarFu Sep 7, 2020
dcf7306
Reusing the slack_rtm.py methods
AgarFu Sep 7, 2020
709d174
Removing temporal patches
AgarFu Sep 7, 2020
1a991b0
Refactoring SlackRTM
AgarFu Sep 7, 2020
e0fa7d1
Merge branch 'no_enough_permissions' into slack_event_api_support
AgarFu Sep 7, 2020
5facafe
Merge branch 'master' of https://github.com/errbotio/errbot into no_e…
AgarFu Nov 8, 2020
277376f
Fixing deprecation errors
AgarFu Nov 9, 2020
814536e
Merge branch 'master' of https://github.com/errbotio/errbot into slac…
AgarFu Nov 9, 2020
63a5fa7
Merge branch 'no_enough_permissions' into slack_event_api_support
AgarFu Nov 9, 2020
882e097
Refactoring SlackRTM
AgarFu Sep 7, 2020
930db2a
fixed rendering issue in docs (#1452)
torgeirl Sep 10, 2020
a373b57
fix: merging configs via --storage-merge cli (#1450)
sijis Sep 10, 2020
d4c20ed
Added email property for slack backend SlackPerson class (#1186)
aaugustinas Sep 28, 2020
22ddf1c
fix: Add missing email property to backends (#1456)
sijis Oct 6, 2020
ee1f27c
chore: Add github actions (#1455)
sijis Oct 6, 2020
d7197c8
chore: update changelog and vcheck for 6.1.5
sijis Oct 10, 2020
2d1250f
fix: Add content type to package long description
sijis Oct 10, 2020
c310e22
fix: Set email property as non-abstract (#1461)
sijis Oct 16, 2020
f55d804
fix: username to userid method signature (#1458)
sijis Oct 17, 2020
b88a75d
fix: AttributeError in callback_reaction (#1467)
sijis Oct 22, 2020
622928e
docs: fix webhook examples (#1471)
sijis Oct 26, 2020
93b050a
fix: merging configs via cli with unknown keys (#1470)
sijis Oct 27, 2020
a4766e1
Fix error when plugin plug file is missing description (#1462)
bribroder Oct 27, 2020
4509b4e
docs: Fix typographical issues in setup guide (#1475)
e4r7hbug Nov 1, 2020
7ecd741
Update code to support markdown 3 (#1473)
b1rger Nov 4, 2020
6f0d91f
refactor: Split changelog by major versions (#1474)
sijis Nov 4, 2020
625411e
Fixing deprecation errors
AgarFu Nov 9, 2020
83b4108
chore: update changelog and vcheck for 6.1.6
sijis Nov 17, 2020
32e9a82
Allow dependabot to check GitHub actions weekly (#1464)
jlosito Nov 19, 2020
e15cd14
Enable testing using Python 3.9 (#1477)
nzlosh Nov 19, 2020
1529be0
Rename backend to slack_sdk to reflect the underlying module and the …
nzlosh Nov 23, 2020
8b94e66
blacken code
nzlosh Nov 23, 2020
caeaad9
Declare module dependencies.
nzlosh Nov 23, 2020
d7611ab
Mash-up slack backends.
nzlosh Nov 23, 2020
269b286
Include aiohttp dependency for slacksdk.
nzlosh Nov 24, 2020
d9d6407
Removed SlackRTMBackend from slack_sdk.py since it breaks errbot back…
nzlosh Nov 24, 2020
c0b1275
Completely merge events errbot into base class.
nzlosh Nov 24, 2020
2727da6
Fixed reference to SlackBackend class.
nzlosh Nov 24, 2020
e632485
Provide a fake serveonce method to satisfy Errbot API contract.
nzlosh Nov 24, 2020
45f5ecc
Use base class message limit methods.
nzlosh Nov 24, 2020
b93732d
Include missing module.
nzlosh Nov 24, 2020
afa67e7
Temporarily use configuration setting to indicate the slack api to use.
nzlosh Nov 25, 2020
88cfbf3
Merge branch 'master' into slack_event_api_support
nzlosh Nov 25, 2020
c950d55
Merge branch 'slack_event_api_support' of https://github.com/AgarFu/e…
nzlosh Nov 25, 2020
1ffdacc
Align backend variable names with slacksdk names.
nzlosh Nov 25, 2020
6e4ebdd
Clean up established network connection when backend is shutdown.
nzlosh Nov 26, 2020
23768b4
Merge branch 'master' of https://github.com/errbotio/errbot into coop…
AgarFu Nov 26, 2020
7a33fe8
Merge remote-tracking branch 'carlos/slack_event_api_support' into sl…
AgarFu Nov 26, 2020
821ee6a
Merge pull request #2 from AgarFu/slack_event_api_refactor
AgarFu Nov 26, 2020
c5dad0d
Skipping slack tests
AgarFu Nov 27, 2020
b69f3f5
Merge branch 'slack_event_api_support' of https://github.com/AgarFu/e…
AgarFu Nov 27, 2020
43cc136
Fixing codestyle
AgarFu Nov 27, 2020
ebe28b9
Codestyle
AgarFu Nov 27, 2020
a57050a
Refactor started, added test for slack markdown infrastructure
AgarFu Nov 27, 2020
cce5e9c
Making codestyle happy again
AgarFu Nov 27, 2020
38ded3f
Making codestyle happy
AgarFu Nov 27, 2020
3ce8dcf
Installing slack_sdk for tests
AgarFu Nov 27, 2020
c684a2a
Testing channel name
AgarFu Nov 27, 2020
f65c444
Not implemented error
AgarFu Nov 27, 2020
8670371
Refactoring to optimize the cache and reduce duplications
AgarFu Nov 27, 2020
72eacc7
Small refactor, done testing SlackPerson
AgarFu Nov 27, 2020
53db013
100% coverage for person
AgarFu Nov 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Temporarily use configuration setting to indicate the slack api to use.
  • Loading branch information
nzlosh committed Nov 25, 2020
commit afa67e7a1e8bb196e16b13728f1e63724eb12877
21 changes: 13 additions & 8 deletions errbot/backends/slack_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,9 @@ def __init__(self, config):
self.token = identity.get("token", None)
self.proxies = identity.get("proxies", None)

# Force RTM API during MVP development
slack_api = "rtm"
# Select which Slack API model to use. Default to Real-Time Messaging API to remain
# backward compatiable with the original errbot slack backend.
self.slack_api = identity.get("api", "rtm")

if not self.token:
log.fatal(
Expand All @@ -352,12 +353,12 @@ def __init__(self, config):
sys.exit(1)

# Handle extra variables when using Events API.
if slack_api == "events":
if self.slack_api == "events":
self.signing_secret = identity.get("signing_secret", None)
if not self.signing_secret:
log.fatal(
'You need to set your signing_secret (found under "Bot Integration" on Slack) in '
"the BOT_IDENTITY setting in your configuration. Without this secret I "
'You need to set your signing_secret (found under "Bot Integration" on Slack)'
" in the BOT_IDENTITY setting in your configuration. Without this secret I "
"cannot receive events from Slack."
)
sys.exit(1)
Expand All @@ -376,6 +377,10 @@ def set_message_size_limit(self, limit=4096, hard_limit=40000):
"""
super().set_message_size_limit(limit, hard_limit)

# Listen for oauthv2 challenge-response
def oauth_challenge_response(self):
raise NotImplementedError

@staticmethod
def _unpickle_identifier(identifier_str):
return SlackBackend.__build_identifier(identifier_str)
Expand Down Expand Up @@ -436,12 +441,12 @@ def serve_presences(**payload):
self._presence_change_event_handler(payload["web_client"], payload["data"])

def serve_once(self):
self.debug("Fake establishing connection to Slack. Stop after 1 second.")
self.debug("Serve once isn't supported. Stopping after 1 second.")
sleep(1)

def serve_forever(self):
slack_api = "rtm"
if slack_api == "rtm":
if self.slack_api == "rtm":
log.debug("Running RTM ")
self.serve_forever_rtm()
else:
self.serve_forever_events()
Expand Down