Class: ChatgptAssistant::ApplicationBot

Inherits:
Object
  • Object
show all
Includes:
AudioHelper, FileHelper, MessengerHelper, SearchHelper
Defined in:
lib/chatgpt_assistant/bots/application_bot.rb

Overview

This class is responsible to contain the shared attributes and methods

Direct Known Subclasses

DiscordBot, TelegramBot

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileHelper

#delete_file

Methods included from SearchHelper

#find_user, #find_visitor, #where_user

Methods included from AudioHelper

#recognition, #synthesis, #transcribe_file

Methods included from MessengerHelper

#parse_message

Constructor Details

#initialize(config) ⇒ ApplicationBot

Returns a new instance of ApplicationBot.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 27

def initialize(config)
  @config = config
  default_msg = DefaultMessages.new(@config.language)
  @openai_api_key = @config.openai_api_key
  @telegram_token = @config.telegram_token
  @discord_token = @config.discord_token
  @discord_client_id = @config.discord_client_id
  @discord_prefix = @config.discord_prefix
  @database = @config.db_connection
  @mode = @config.mode
  @common_messages = default_msg.common_messages
  @error_messages = default_msg.error_messages
  @success_messages = default_msg.success_messages
  @help_messages = default_msg.help_messages
end

Instance Attribute Details

#audio_urlObject

Returns the value of attribute audio_url.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def audio_url
  @audio_url
end

#botObject

Returns the value of attribute bot.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def bot
  @bot
end

#chatObject

Returns the value of attribute chat.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def chat
  @chat
end

#chat_idObject

Returns the value of attribute chat_id.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def chat_id
  @chat_id
end

#common_messagesObject (readonly)

Returns the value of attribute common_messages.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def common_messages
  @common_messages
end

#configObject (readonly)

Returns the value of attribute config.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def config
  @config
end

#databaseObject (readonly)

Returns the value of attribute database.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def database
  @database
end

#default_msgObject (readonly)

Returns the value of attribute default_msg.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def default_msg
  @default_msg
end

#discord_client_idObject (readonly)

Returns the value of attribute discord_client_id.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def discord_client_id
  @discord_client_id
end

#discord_prefixObject (readonly)

Returns the value of attribute discord_prefix.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def discord_prefix
  @discord_prefix
end

#discord_tokenObject (readonly)

Returns the value of attribute discord_token.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def discord_token
  @discord_token
end

#error_messagesObject (readonly)

Returns the value of attribute error_messages.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def error_messages
  @error_messages
end

#evntObject

Returns the value of attribute evnt.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def evnt
  @evnt
end

#help_messagesObject (readonly)

Returns the value of attribute help_messages.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def help_messages
  @help_messages
end

#modeObject (readonly)

Returns the value of attribute mode.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def mode
  @mode
end

#msgObject

Returns the value of attribute msg.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def msg
  @msg
end

#openai_api_keyObject (readonly)

Returns the value of attribute openai_api_key.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def openai_api_key
  @openai_api_key
end

#success_messagesObject (readonly)

Returns the value of attribute success_messages.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def success_messages
  @success_messages
end

#telegram_tokenObject (readonly)

Returns the value of attribute telegram_token.



43
44
45
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 43

def telegram_token
  @telegram_token
end

#userObject

Returns the value of attribute user.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def user
  @user
end

#visitorObject

Returns the value of attribute visitor.



47
48
49
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 47

def visitor
  @visitor
end

Instance Method Details

#chatterObject



49
50
51
# File 'lib/chatgpt_assistant/bots/application_bot.rb', line 49

def chatter
  @chatter ||= Chatter.new(openai_api_key)
end