Module: ChatgptAssistant::Bots::Discord::Events
- Included in:
- DiscordBot
- Defined in:
- lib/chatgpt_assistant/bots/discord/events.rb
Instance Method Summary collapse
- #ask_event ⇒ Object
- #help_event ⇒ Object
- #hist_event ⇒ Object
- #list_event ⇒ Object
- #login_event ⇒ Object
- #new_chat_event ⇒ Object
- #private_message_event ⇒ Object
- #sl_chat_event ⇒ Object
- #speak_event ⇒ Object
- #start_event ⇒ Object
- #voice_connect_event ⇒ Object
- #voice_disconnect_event ⇒ Object
Instance Method Details
#ask_event ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 72 def ask_event bot.command :ask do |event| @evnt = event = event..content.split[1..].join(" ") event.respond [:user_not_logged_in] if user.nil? event.respond [:account_not_verified] if user && !user.active? ask_action if user&.active? "OK" end end |
#help_event ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 43 def help_event bot.command :help do |event| @evnt = event help_action "OK" end end |
#hist_event ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 33 def hist_event bot.command :hist do |event| @evnt = event @chat = user.current_chat event.respond [:chat_not_found] if chat.nil? && user hist_action if user && chat "OK" end end |
#list_event ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 25 def list_event bot.command :list do |event| @evnt = event list_action if valid_for_list_action? "OK" end end |
#login_event ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 16 def login_event bot.command :login do |event| = event..content.split[1] @evnt = event .nil? ? event.respond([:login]) : login_action "OK" end end |
#new_chat_event ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 51 def new_chat_event bot.command :new_chat do |event| @evnt = event event.respond [:user_not_logged_in] if user.nil? event.respond [:account_not_verified] if user && !user.active? create_chat_action if user&.active? "OK" end end |
#private_message_event ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 123 def bot. do |event| @evnt = event @visitor = discord_visited?(@evnt.user.id) next if discord_next_action? = event..content @chat = user.current_chat if user if user && !chat.nil? "OK" end end |
#sl_chat_event ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 61 def sl_chat_event bot.command :sl_chat do |event| @evnt = event chat_to_select = event..content.split[1..].join(" ") event.respond [:user_not_logged_in] if user.nil? event.respond [:account_not_verified] if user && !user.active? sl_chat_action(chat_to_select) if user&.active? "OK" end end |
#speak_event ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 111 def speak_event bot.command :speak do |event| @evnt = event = event..content.split[1..].join(" ") @chat = user.current_chat speak_connect_checker_action speak_connection_checker_action ask_to_speak_action if user && event.user.voice_channel && event.voice && !chat.nil? "OK" end end |
#start_event ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 7 def start_event bot.command :start do |event| @evnt = event @user = event.user start_action "Ok" end end |
#voice_connect_event ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 83 def voice_connect_event bot.command :connect do |event| @evnt = event if user && !user.active? event.respond [:account_not_verified] elsif user&.current_chat_id.nil? event.respond [:no_chat_selected] elsif user&.current_chat_id @chat = Chat.find(user.current_chat_id) voice_connect_checker_action voice_connection_checker_action bot.voice_connect(event.user.voice_channel) else event.respond [:user_not_logged_in] end "OK" end end |
#voice_disconnect_event ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/chatgpt_assistant/bots/discord/events.rb', line 102 def voice_disconnect_event bot.command :disconnect do |event| @evnt = event disconnect_checker_action disconnect_action if user && event.user.voice_channel && event.voice "OK" end end |