Module: ChatgptAssistant::Bots::Discord::ChatActions
- Included in:
- DiscordBot
- Defined in:
- lib/chatgpt_assistant/bots/discord/chat_actions.rb
Instance Method Summary collapse
- #answer_action ⇒ Object
- #ask_action ⇒ Object
- #private_message_action ⇒ Object
- #send_message(text) ⇒ Object
Instance Method Details
#answer_action ⇒ Object
21 22 23 24 |
# File 'lib/chatgpt_assistant/bots/discord/chat_actions.rb', line 21 def answer_action response = chatter.chat(.content, chat.id, [:something_went_wrong]) response end |
#ask_action ⇒ Object
7 8 9 10 11 12 |
# File 'lib/chatgpt_assistant/bots/discord/chat_actions.rb', line 7 def ask_action @chat = Chat.where(id: user.current_chat_id).last [:chat_not_found] if chat.nil? @message = Message.new(chat_id: chat.id, content: , role: "user") if chat (.save ? answer_action : ([:message_not_saved])) if chat end |
#private_message_action ⇒ Object
14 15 16 17 18 19 |
# File 'lib/chatgpt_assistant/bots/discord/chat_actions.rb', line 14 def @chat = Chat.where(id: user.current_chat_id).last [:chat_not_found] if chat.nil? @message = Message.new(chat_id: chat.id, content: , role: "user") if chat (.save ? answer_action : ([:message_not_saved])) if chat end |
#send_message(text) ⇒ Object
26 27 28 29 |
# File 'lib/chatgpt_assistant/bots/discord/chat_actions.rb', line 26 def (text) = (text, 2000) .each { |m| evnt.respond m } end |