Add default_config, and cfg[:timeout] for tasks

- Using the @default_config attribute in a module will fill out a default
value.
- cfg[:timeout] sets the timeout for the task for this module to finish.
- Update Omnibot.Irc.route_msg/2 to have each task spawn a second task,
  while the first task waits for its child to finish, otherwise killing
  it.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-06-13 21:47:46 -04:00
parent a6a07adf7a
commit 4083b5b858
5 changed files with 30 additions and 11 deletions

View File

@@ -2,6 +2,8 @@ defmodule Omnibot.Core do
use Omnibot.Module
alias Omnibot.State
@default_config [channels: :all]
@impl true
def on_join(irc, channel, nick) do
cfg = State.cfg()