def __init__(self):
load_dotenv(".env")
#
BOT_CHANNEL_GENERAL = os.environ.get("BOT_CHANNEL_GENERAL")
SLACK_BOT_TOKEN = os.environ.get("SLACK_BOT_TOKEN")
#
self.BOT_ID = os.environ.get("BOT_ID")
self.AT_BOT = "<@" + str(self.BOT_ID) + ">"
self.WEATHER_API_TOKEN = os.environ.get("WEATHER_API_TOKEN")
self.slack_client = SlackClient(SLACK_BOT_TOKEN)
self.public_channels_list = [BOT_CHANNEL_GENERAL]
self.input = Input(self)
self.command = Command(self)
self.weather = Weather(self)
#
if self.slack_client.rtm_connect():
print("Bot connected and running!")
self.input.read()
else:
print("Connection failed. Invalid Slack token or bot ID?")
评论列表
文章目录