The problem: When we're going through the list of modules to send messages to based on the channels they're a part of, it was being done so through the config. Since the config doesn't (and shouldn't) list all of the core modules that get included, any core modules that were loaded and running under the ModuleSupervisor would not get included in the router's attempt to send messages to a module. Now, the Config.all_channels and Config.channel_modules functions live in State, and State has a new "add_loaded_module" function where loaded modules are registered. The aforementioned moved functions will use this as the "source of truth" when deciding where to send messages for modules to handle. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
32 lines
723 B
Elixir
32 lines
723 B
Elixir
defmodule Omnibot.Contrib.Fortune do
|
||
use Omnibot.Module
|
||
|
||
@fortunes [
|
||
"Reply hazy, try again",
|
||
"Excellent Luck",
|
||
"Good Luck",
|
||
"Average Luck",
|
||
"Bad Luck",
|
||
"Good news will come to you by mail",
|
||
"´_ゝ`",
|
||
"タ━━━━━━(゚∀゚)━━━━━━ !!!!",
|
||
"You will meet a dark handsome stranger",
|
||
"Better not tell you now",
|
||
"Outlook good",
|
||
"Very Bad Luck",
|
||
"Godly Luck",
|
||
]
|
||
|
||
command "!fortune", [to] do
|
||
fortune = Enum.random(@fortunes)
|
||
reply = "#{to}: #{fortune}"
|
||
Irc.send_to(irc, channel, reply)
|
||
end
|
||
|
||
command "!fortune" do
|
||
fortune = Enum.random(@fortunes)
|
||
reply = "#{nick}: #{fortune}"
|
||
Irc.send_to(irc, channel, reply)
|
||
end
|
||
end
|