Discord_Elixir_test/lib/haha_yes.ex
2024-10-12 14:38:08 +02:00

12 lines
363 B
Elixir

defmodule HahaConsumer do
use Nostrum.Consumer
def handle_event({:MESSAGE_CREATE, msg, _ws_state}) when msg.author.bot != true do
if String.starts_with?(msg.content, "h3h3 ") do
msg.content
|> String.replace("h3h3 ", "")
|> String.split(" ")
|> then(& apply(HahaCommands, String.to_atom(Enum.at(&1, 0)), [msg]))
end
end
end