Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
cdetroye committed Mar 26, 2018
1 parent d4a3de4 commit f960cad
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/bot/benvolioss.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Plugin.Benvolios do
use Slackbot.Plugin
require Logger


@boss Application.fetch_env!(:slack, :benvolios_owner)
@channel Application.fetch_env!(:slack, :benvolios_channel)

Expand All @@ -13,14 +12,18 @@ defmodule Plugin.Benvolios do
# Compute all permutations of the first word in the string.
# if it matches "order", turn it into "order".
words = String.split(text)
perms = words |> hd |> String.to_charlist() |> shuffle() |> Enum.map(&String.Chars.to_string/1)
match? = Enum.any?(perms, &(String.equivalent?("order", &1)))

text = if match? do
(["order"] ++ (words |> tl)) |> Enum.join(" ")
else
text
end
perms =
words |> hd |> String.to_charlist() |> shuffle() |> Enum.map(&String.Chars.to_string/1)

match? = Enum.any?(perms, &String.equivalent?("order", &1))

text =
if match? do
(["order"] ++ (words |> tl)) |> Enum.join(" ")
else
text
end

# # Lowercase all the message, for easy pattern matching.
# fmt =
Expand Down

0 comments on commit f960cad

Please sign in to comment.