Class: SlackSmartBot::Config
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- SlackSmartBot::Config
- Defined in:
- lib/slack/smart-bot/config.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Config
constructor
token String: The API Slack token.
Constructor Details
#initialize(*args) ⇒ Config
token String: The API Slack token. user_token String: The Slack User token. granular_token String: The Slack granular token. path String: Path to the folder where the bot is running silent Boolean: If true the bot will not send any message to the chat when starting or stopping testing Boolean: Whether the bot is running in testing mode. simulate Boolean: Whether the bot is running in simulation mode. stats Boolean: Whether the bot should collect and log statistics. allow_access Hash: The access control settings for the bot. on_maintenance Boolean: Whether the bot is on maintenance mode. on_maintenance_message String: The message to send when the bot is on maintenance mode. general_message String: The general message added to be sent on every message the bot sends. logrtm Boolean: Whether the bot should log all messages received and sent (RTM). status_channel String: The channel where the bot will send status messages. stats_channel String: The channel where the bot is allowed to send statistics. jira Hash: The settings for Jira. github Hash: The settings for GitHub. public_holidays Hash: The settings for public holidays. encrypt Boolean: Whether the bot should encrypt the data. encryption Hash: The settings for encryption. If not provided the bot will generate a new key and iv. recover_encrypted Boolean: Whether the bot should recover the encrypted data in case now encrypt is set to false but data is still encrypted. This is used for testing purposes. ai Hash: The settings for OpenAI. ai.open_ai.chat_gpt Hash: The settings for OpenAI ChatGPT. ai.open_ai.dall_e Hash: The settings for OpenAI DALL-E. ai.open_ai.whisper Hash: The settings for OpenAI Whisper. ai.open_ai.models Hash: The settings for OpenAI Models. file String: The file to load the bot from. masters Array: The list of master users. team_id_masters Array: The list of master team_id + user ids. master_channel String: The Smartbot master channel. channel String: The Smartbot channel. status_init Symbol: The initial status of the bot. rules_file String: The file to load the rules from. admins Array: The list of admin users. team_id_admins Array: The list of admin team_id + user ids. start_bots Boolean: Whether the bot should start the bots when starting. ldap Hash: The settings for LDAP. @ldap connection will be created. It will populate the sso_user_name key to 'user' searching by Slack mail specified in profile. authorizations Hash: The authorizations for services. for example: { confluence: 'confluence.example.com', authorization: 'Bearer Adjjj3dddfj'}
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/slack/smart-bot/config.rb', line 44 def initialize(*args) super self.token ||= "" self.user_token ||= "" self.granular_token ||= "" self.path ||= "." self.file ||= "" self.rules_file ||= "" self.start_bots ||= true self.status_init ||= :on self.silent ||= false self.testing ||= false self.simulate ||= false self.logrtm ||= false self.masters ||= [] self.team_id_masters ||= [] self.admins ||= [] self.team_id_admins ||= [] self.stats ||= false self.allow_access ||= {} self.on_maintenance ||= false self. ||= "Sorry I'm on maintenance so I cannot attend your request." self. ||= "" self.master_channel ||= "" # smartbot master channel self.channel ||= "" # smartbot channel self.status_channel ||= "smartbot-status" self.stats_channel ||= "smartbot-stats" self.jira ||= { host: "", user: "", password: "" } self.github ||= { token: "", host: "https://api.github.com" } self.public_holidays ||= { api_key: "", host: "https://calendarific.com", default_calendar: ""} self.encrypt ||= true self.encryption ||= { key: "", iv: "" } self.recover_encrypted ||= false self.ai ||= { open_ai: { testing: false, access_token: "", host: "", chat_gpt: {}, dall_e: {}, whisper: {}, models: {} } } self.ai[:open_ai][:host] = "https://#{self.ai[:open_ai][:host]}" unless self.ai[:open_ai][:host].empty? || self.ai[:open_ai][:host].start_with?("http") self.ai[:open_ai][:chat_gpt] ||= {} self.ai[:open_ai][:dall_e] ||= {} self.ai[:open_ai][:whisper] ||= {} self.ai[:open_ai][:models] ||= {} self.ai[:open_ai][:chat_gpt][:access_token] ||= self.ai[:open_ai][:access_token] self.ai[:open_ai][:dall_e][:access_token] ||= self.ai[:open_ai][:access_token] self.ai[:open_ai][:whisper][:access_token] ||= self.ai[:open_ai][:access_token] self.ai[:open_ai][:models][:access_token] ||= self.ai[:open_ai][:access_token] self.ai[:open_ai][:chat_gpt][:host] ||= self.ai[:open_ai][:host] self.ai[:open_ai][:dall_e][:host] ||= self.ai[:open_ai][:host] self.ai[:open_ai][:whisper][:host] ||= self.ai[:open_ai][:host] self.ai[:open_ai][:models][:host] ||= self.ai[:open_ai][:host] self.ai[:open_ai][:chat_gpt][:model] ||= "gpt-3.5-turbo" self.ai[:open_ai][:chat_gpt][:smartbot_model] ||= self.ai[:open_ai][:chat_gpt][:model] self.ai[:open_ai][:dall_e][:model] ||= "" self.ai[:open_ai][:whisper][:model] ||= "whisper-1" self.ai[:open_ai][:chat_gpt][:api_type] ||= :openai self.ai[:open_ai][:dall_e][:api_type] ||= :openai self.ai[:open_ai][:whisper][:api_type] ||= :openai self.ai[:open_ai][:models][:api_type] ||= self.ai[:open_ai][:chat_gpt][:api_type] self.ai[:open_ai][:chat_gpt][:api_version] ||= "" self.ai[:open_ai][:chat_gpt][:fixed_user] ||= "" self.ai[:open_ai][:models][:api_version] ||= self.ai[:open_ai][:chat_gpt][:api_version] self.ai[:open_ai][:dall_e][:image_size] ||= "256x256" self.ai[:open_ai][:models][:url] ||= "" self.ldap ||= { host: "", port: 389, auth: { user: '', password: '' }, treebase: "dc=ds,dc=eng,dc=YOURCOMPANY,dc=com" } self. ||= {} end |