forked from Zero6992/chatGPT-discord-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bdb48f
commit 61e3660
Showing
7 changed files
with
246 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
discord.py==2.3.2 | ||
python-dotenv==1.0.0 | ||
asgiref==3.7.2 | ||
openai==1.3.5 | ||
requests-cache==1.1.0 | ||
tiktoken>=0.7.0 | ||
aiohttp>=3.8 | ||
multidict>=6.0 | ||
requests>=2.31.0 | ||
attrs>=22.1.0 | ||
yarl>=1.9.2 | ||
idna>=3.4 | ||
charset-normalizer>=3.2.0 | ||
propcache>=0.1.0 | ||
aiohappyeyeballs>=0.2.0 | ||
aiosignal>=1.3.1 | ||
async-timeout>=4.0.3 | ||
frozenlist>=1.4.0 | ||
urllib3>=2.0.4 | ||
certifi>=2024.8.30 | ||
url_normalize>=1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Optional, Tuple | ||
from utils.log import logger | ||
|
||
# Action code definitions | ||
ACTION_CODES = { | ||
"!SPORTS": "sports", | ||
"!SPORTSNOW": "sportsnow", | ||
"!WEATHER": "weather", | ||
"!NEWS": "news", | ||
"!DRAW": "draw" | ||
} | ||
|
||
async def process_action_code(message: str) -> Optional[Tuple[str, str]]: | ||
"""Check if message contains an action code and extract parameters.""" | ||
for code in ACTION_CODES: | ||
# Use find instead of startswith to catch action codes anywhere in the message | ||
index = message.find(code) | ||
if index != -1: | ||
# Extract everything after the action code | ||
params = message[index + len(code):].strip() | ||
logger.info(f"Action code detected: {code} with params: {params}") | ||
return (code, params) | ||
return None |
Oops, something went wrong.