webex-bot 0.5.1__py2.py3-none-any.whl → 0.5.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
webex_bot/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Top-level package for Webex Bot."""
2
2
 
3
3
  __author__ = """Finbarr Brady"""
4
- __version__ = '0.5.1'
4
+ __version__ = '0.5.2'
@@ -9,8 +9,9 @@ COMMAND_KEYWORD_KEY = "command_keyword"
9
9
 
10
10
  class Command(ABC):
11
11
 
12
- def __init__(self, command_keyword=None, chained_commands=[], card=None, help_message=None,
13
- delete_previous_message=False,
12
+ def __init__(self, command_keyword=None, exact_command_keyword_match=False,
13
+ chained_commands=[], card=None,
14
+ help_message=None, delete_previous_message=False,
14
15
  card_callback_keyword=None, approved_rooms=None):
15
16
  """
16
17
  Create a new bot command.
@@ -25,6 +26,7 @@ class Command(ABC):
25
26
  )
26
27
 
27
28
  @param command_keyword: (optional) Text indicating a phrase to invoke this card.
29
+ @param exact_command_keyword_match: If True, there will be an exact command_keyword match performed. If False, then a sub-string match will be performed. Default: False.
28
30
  @param chained_commands: (optional) List of other commands related
29
31
  to this command. This allows multiple related cards to be added at once.
30
32
  @param card: (deprecated) A dict representation of the JSON card.
@@ -37,6 +39,7 @@ class Command(ABC):
37
39
  @param approved_rooms: If defined, only members of these spaces will be allowed to run this command. Default: None (everyone)
38
40
  """
39
41
  self.command_keyword = command_keyword
42
+ self.exact_command_keyword_match = exact_command_keyword_match
40
43
  self.help_message = help_message
41
44
  self.card = card
42
45
  self.pre_card_callback = self.execute
webex_bot/webex_bot.py CHANGED
@@ -234,10 +234,21 @@ class WebexBot(WebexWebsocketClient):
234
234
 
235
235
  if not is_card_callback_command and c.command_keyword:
236
236
  log.debug(f"c.command_keyword: {c.command_keyword}")
237
- if user_command.find(c.command_keyword) != -1:
238
- command = c
239
- # If a command was found, stop looking for others
240
- break
237
+ log.info(f"exact_command_keyword_match: {c.exact_command_keyword_match}")
238
+ log.info(f"user_command: {user_command}")
239
+ log.info(f"command_keyword: {c.command_keyword}")
240
+ if c.exact_command_keyword_match: # Check if the "exact_command_keyword_match" flag is set to True
241
+ if user_command == c.command_keyword:
242
+ log.info("Exact match found!")
243
+ command=c
244
+ # If a command was found, stop looking for others
245
+ break
246
+ else: # Enter here if the "exact_command_keyword_match" flag is set to False
247
+ if user_command.find(c.command_keyword) != -1:
248
+ log.info("Sub-string match found!")
249
+ command = c
250
+ # If a command was found, stop looking for others
251
+ break
241
252
  else:
242
253
  log.debug(f"card_callback_keyword: {c.card_callback_keyword}")
243
254
  if user_command == c.command_keyword or user_command == c.card_callback_keyword:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webex-bot
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Python package for a Webex Bot based on websockets.
5
5
  Home-page: https://github.com/fbradyirl/webex_bot
6
6
  Author: Finbarr Brady
@@ -17,17 +17,25 @@ Classifier: Programming Language :: Python :: 3.9
17
17
  Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: webexteamssdk ==1.6.1
20
+ Requires-Dist: webexteamssdk==1.6.1
21
21
  Requires-Dist: coloredlogs
22
- Requires-Dist: websockets ==11.0.3
22
+ Requires-Dist: websockets==11.0.3
23
23
  Requires-Dist: backoff
24
24
  Provides-Extra: proxy
25
- Requires-Dist: websockets-proxy >=0.1.1 ; extra == 'proxy'
25
+ Requires-Dist: websockets-proxy>=0.1.1; extra == "proxy"
26
26
 
27
27
  # Introduction
28
28
 
29
29
  [![Pypi](https://img.shields.io/pypi/v/webex_bot.svg)](https://pypi.python.org/pypi/webex_bot) [![Build Status](https://github.com/fbradyirl/webex_bot/workflows/Python%20package/badge.svg)](https://github.com/fbradyirl/webex_bot/actions)
30
30
 
31
+ > [!IMPORTANT]
32
+ > This repository is only sporadically maintained. Breaking API changes will be maintained on a best efforts basis.
33
+ >
34
+ > Collaborators are welcome, as are PRs for enhancements.
35
+ >
36
+ > Bug reports unrelated to API changes may not get the attention you want.
37
+
38
+
31
39
  By using this module, you can create a [Webex Teams][5] messaging bot quickly in just a couple of lines of code.
32
40
 
33
41
  This module does not require you to set up an ngrok tunnel to receive incoming messages when behind a firewall or
@@ -382,6 +390,10 @@ and off you go!
382
390
 
383
391
  * Add Proxy Support. ([#56][pr56])
384
392
 
393
+ ### 0.5.2 (2024-Aug-21)
394
+
395
+ * Introduce exact_command_keyword_match feature ([#59][pr59])
396
+
385
397
  [1]: https://github.com/aaugustin/websockets
386
398
 
387
399
  [2]: https://github.com/CiscoDevNet/webexteamssdk
@@ -408,6 +420,8 @@ and off you go!
408
420
 
409
421
  [pr56]: https://github.com/fbradyirl/webex_bot/pull/56
410
422
 
423
+ [pr59]: https://github.com/fbradyirl/webex_bot/pull/59
424
+
411
425
  [i1]: https://github.com/fbradyirl/webex_bot/issues/1
412
426
 
413
427
  [i2]: https://github.com/fbradyirl/webex_bot/issues/2
@@ -1,18 +1,18 @@
1
- webex_bot/__init__.py,sha256=fIrggpbtbmnosDI6vwtRg8leUTo8BeJZJZqojDOzZGM,95
1
+ webex_bot/__init__.py,sha256=JfFcRVsDoAtttzwsMUmplNDZyvQ4gsjzQH9P1fx6XRo,95
2
2
  webex_bot/exceptions.py,sha256=qs9yVitfJtvxwBMC8uCvTDOxUQ_oZjWFf1dU8Oaue14,740
3
3
  webex_bot/formatting.py,sha256=jvPKym-z8CIJygpPVTVbt6vFXQo9_HQHpRDJB-nh-SI,382
4
- webex_bot/webex_bot.py,sha256=f4qJeNfl1x-dvFyAxcBrAWTT0HB-pAq0Kl3gfjrXYe0,20473
4
+ webex_bot/webex_bot.py,sha256=fUGMMIJVcwoP4fIaIyvvpSxoaMAl34dXSk0_QX44VGo,21222
5
5
  webex_bot/cards/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  webex_bot/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  webex_bot/commands/echo.py,sha256=YmeRVh56pzsj0_lRHDvgyrv6YqQQdRiusG65dHTh9qU,3397
8
8
  webex_bot/commands/help.py,sha256=s4buQxnmHijkqWiYs8RZ_H-yzi3EhAffSozPCGNndD0,3468
9
9
  webex_bot/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- webex_bot/models/command.py,sha256=Rok661eZM2Mg465CZ4GgctWi1RD-BD5Bruq0FsJ8GDQ,5023
10
+ webex_bot/models/command.py,sha256=HyZqS3oIEiWpHIEq8UvXPDHwd-opB-VWZxf2M3HKgvM,5325
11
11
  webex_bot/models/response.py,sha256=1U0EQv8O5R3-demaumxMExn278DG4AeQHhXP_g4xndk,2544
12
12
  webex_bot/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  webex_bot/websockets/webex_websocket_client.py,sha256=QUTQUWgnBYg3bSZ857m_vM49Ns9GWHWT69TYP4U6R9I,10627
14
- webex_bot-0.5.1.dist-info/LICENSE,sha256=93eGb10xmgkBP2Fh_n0E9YDXe0c0oz-FsnAimXG0S4Y,1072
15
- webex_bot-0.5.1.dist-info/METADATA,sha256=aSiwp8MqPv55j1njJOpHRCF_FnDiB077O-f_hzKqBhg,11991
16
- webex_bot-0.5.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
17
- webex_bot-0.5.1.dist-info/top_level.txt,sha256=q1Y0RtYYinR7oXSwL93cK59c2KN_CbMVca8MLWeF63M,10
18
- webex_bot-0.5.1.dist-info/RECORD,,
14
+ webex_bot-0.5.2.dist-info/LICENSE,sha256=93eGb10xmgkBP2Fh_n0E9YDXe0c0oz-FsnAimXG0S4Y,1072
15
+ webex_bot-0.5.2.dist-info/METADATA,sha256=-GLfltxFyjZyDkIUgN7BDZAyjSSzqMhmF4yWxiwxn2o,12401
16
+ webex_bot-0.5.2.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
17
+ webex_bot-0.5.2.dist-info/top_level.txt,sha256=q1Y0RtYYinR7oXSwL93cK59c2KN_CbMVca8MLWeF63M,10
18
+ webex_bot-0.5.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any