Import only what you need, remove some unused things
This commit is contained in:
parent
c0dcfa8820
commit
99f1eaecee
1 changed files with 5 additions and 5 deletions
10
main-v2.py
10
main-v2.py
|
@ -1,6 +1,6 @@
|
||||||
import os, sys
|
from os import environ as env
|
||||||
|
from sys import argv
|
||||||
from slack_bolt import App
|
from slack_bolt import App
|
||||||
from slack_bolt.adapter.socket_mode import SocketModeHandler
|
|
||||||
from slack_sdk.errors import SlackApiError
|
from slack_sdk.errors import SlackApiError
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import firepup650 as fp
|
import firepup650 as fp
|
||||||
|
@ -17,13 +17,13 @@ fp.replitCursor = (
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
for requiredVar in ["SLACK_BOT_TOKEN"]:
|
for requiredVar in ["SLACK_BOT_TOKEN"]:
|
||||||
if not os.environ.get(requiredVar):
|
if not env.get(requiredVar):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f'Missing required environment variable "{requiredVar}". Please create a .env file in the same directory as this script and define the missing variable.'
|
f'Missing required environment variable "{requiredVar}". Please create a .env file in the same directory as this script and define the missing variable.'
|
||||||
)
|
)
|
||||||
|
|
||||||
print("[INFO] Establishing a connection to slack...")
|
print("[INFO] Establishing a connection to slack...")
|
||||||
app = App(token=os.environ.get("SLACK_BOT_TOKEN"))
|
app = App(token=env.get("SLACK_BOT_TOKEN"))
|
||||||
client = app.client
|
client = app.client
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ userMappings = {}
|
||||||
botMappings = {}
|
botMappings = {}
|
||||||
cursor = "N/A"
|
cursor = "N/A"
|
||||||
try:
|
try:
|
||||||
if "--no-cache" in sys.argv:
|
if "--no-cache" in argv:
|
||||||
print("[INFO] Skipping cache on user request")
|
print("[INFO] Skipping cache on user request")
|
||||||
raise ImportError("User requested to skip cache")
|
raise ImportError("User requested to skip cache")
|
||||||
print("[INFO] Trying to load user and app mappings from cache...")
|
print("[INFO] Trying to load user and app mappings from cache...")
|
||||||
|
|
Loading…
Add table
Reference in a new issue