diff options
Diffstat (limited to 'lib/lsg/telegram_room.ex')
-rw-r--r-- | lib/lsg/telegram_room.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lsg/telegram_room.ex b/lib/lsg/telegram_room.ex index 9504cd4..1eeec8f 100644 --- a/lib/lsg/telegram_room.ex +++ b/lib/lsg/telegram_room.ex @@ -12,7 +12,7 @@ defmodule LSG.TelegramRoom do case IRC.Connection.get_network(net, chan) do %IRC.Connection{} -> :global.register_name({__MODULE__, net, chan}, self()) - {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:message", plugin: __MODULE__) + {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:messages", plugin: __MODULE__) {:ok, _} = Registry.register(IRC.PubSub, "#{net}/#{chan}:triggers", plugin: __MODULE__) err -> Logger.warn("Did not found telegram match for #{id} \"#{chat["title"]}\"") @@ -44,6 +44,10 @@ defmodule LSG.TelegramRoom do {:ok, state} end + def handle_info({:irc, _, _, message}, state) do + handle_info({:irc, nil, message}, state) + end + def handle_info({:irc, _, %IRC.Message{sender: %{nick: nick}, text: text}}, state) do LSG.Telegram.send_message(state.id, "<#{nick}> #{text}") {:ok, state} |