Compare commits

...

2 commits

Author SHA1 Message Date
79ebe9b1e1 Removed hardcoded value with spaghetti 2024-10-12 21:37:17 +02:00
02ccacf3d0 repeat what the user says 2024-10-12 21:37:06 +02:00
2 changed files with 22 additions and 1 deletions

21
lib/HahaCommands/say.ex Normal file
View file

@ -0,0 +1,21 @@
defmodule HahaYes.Commands.Say do
@moduledoc """
Repeat back what the user said
"""
alias Nostrum.Api
@doc """
Repeat back what the user said
## Example
User: h3h3 say how are you
Bot: how are you
"""
def execute(msg, _ws_state, args) do
Api.create_message(msg.channel_id, Enum.join(args, " "))
end
end

View file

@ -21,7 +21,7 @@ defmodule HahaYes.Events.MessagesConsumer do
|> Enum.at(0) |> Enum.at(0)
|> String.downcase() |> String.downcase()
|> String.capitalize() |> String.capitalize()
|> then(& Module.concat(HahaYes.Commands, &1).execute(msg, ws_state, String.split(String.replace(msg.content, "h3h3 download ", "")))) |> then(& Module.concat(HahaYes.Commands, &1).execute(msg, ws_state, String.split(String.replace(String.downcase(msg.content), "#{prefix}#{String.downcase(&1)} ", ""))))
end end
end end
end end