Compare commits
2 commits
c0dba0633b
...
79ebe9b1e1
Author | SHA1 | Date | |
---|---|---|---|
79ebe9b1e1 | |||
02ccacf3d0 |
2 changed files with 22 additions and 1 deletions
21
lib/HahaCommands/say.ex
Normal file
21
lib/HahaCommands/say.ex
Normal 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
|
|
@ -21,7 +21,7 @@ defmodule HahaYes.Events.MessagesConsumer do
|
|||
|> Enum.at(0)
|
||||
|> String.downcase()
|
||||
|> 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
|
||||
|
|
Loading…
Reference in a new issue