summaryrefslogtreecommitdiff
path: root/lib/lsg
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-03 04:04:21 +0200
committerhref <href@random.sh>2021-09-03 04:04:21 +0200
commit5399fc818cf821c75f9f19fd00bf7905ba7fe7e3 (patch)
tree00408724f9778cc7323b1459782a762626d39b6a /lib/lsg
parentassets.. (diff)
various fixes, web client wip, pubsub events
Diffstat (limited to 'lib/lsg')
-rw-r--r--lib/lsg/telegram.ex2
-rw-r--r--lib/lsg/telegram_room.ex6
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/lsg/telegram.ex b/lib/lsg/telegram.ex
index e8758e3..63940dc 100644
--- a/lib/lsg/telegram.ex
+++ b/lib/lsg/telegram.ex
@@ -206,7 +206,7 @@ defmodule LSG.Telegram do
trigger: IRC.Connection.extract_trigger(trigger_text),
at: nil
}
- IRC.Connection.publish(message, ["message:private", "message:telegram"])
+ IRC.Connection.publish(message, ["messages:private", "messages:telegram", "telegram/#{account.id}:messages"])
message
end
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}