summaryrefslogtreecommitdiff
path: root/lib/lsg_telegram/telegram.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsg_telegram/telegram.ex')
-rw-r--r--lib/lsg_telegram/telegram.ex14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/lsg_telegram/telegram.ex b/lib/lsg_telegram/telegram.ex
index 748a456..ef5c3b8 100644
--- a/lib/lsg_telegram/telegram.ex
+++ b/lib/lsg_telegram/telegram.ex
@@ -1,4 +1,4 @@
-defmodule LSG.Telegram do
+defmodule Nola.Telegram do
require Logger
@behaviour Telegram.ChatBot
@@ -9,13 +9,13 @@ defmodule LSG.Telegram do
def send_message(id, text, md2 \\ false) do
md = if md2, do: "MarkdownV2", else: "Markdown"
token = Keyword.get(Application.get_env(:lsg, :telegram, []), :key)
- Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(LSG.Telegram, id)
+ Telegram.Bot.ChatBot.Chat.Session.Supervisor.start_child(Nola.Telegram, id)
Telegram.Api.request(token, "sendMessage", chat_id: id, text: text, parse_mode: "Markdown")
end
@impl Telegram.ChatBot
def init(chat_id) when chat_id < 0 do
- {:ok, state} = LSG.TelegramRoom.init(chat_id)
+ {:ok, state} = Nola.TelegramRoom.init(chat_id)
{:ok, %{room_state: state}}
end
def init(chat_id) do
@@ -27,7 +27,7 @@ defmodule LSG.Telegram do
@impl Telegram.ChatBot
def handle_update(update, token, %{room_state: room_state}) do
- {:ok, room_state} = LSG.TelegramRoom.handle_update(update, token, room_state)
+ {:ok, room_state} = Nola.TelegramRoom.handle_update(update, token, room_state)
{:ok, %{room_state: room_state}}
end
@@ -134,7 +134,7 @@ defmodule LSG.Telegram do
path = "https://api.telegram.org/file/bot#{t}/#{file["file_path"]}",
{:ok, %HTTPoison.Response{status_code: 200, body: body}} <- HTTPoison.get(path),
<<smol_body::binary-size(20), _::binary>> = body,
- {:ok, magic} <- GenMagic.Pool.perform(LSG.GenMagic, {:bytes, smol_body}),
+ {:ok, magic} <- GenMagic.Pool.perform(Nola.GenMagic, {:bytes, smol_body}),
bucket = Application.get_env(:lsg, :s3, []) |> Keyword.get(:bucket),
ext = Path.extname(file["file_path"]),
s3path = "#{account.id}/#{file_unique_id}#{ext}",
@@ -142,7 +142,7 @@ defmodule LSG.Telegram do
s3req = ExAws.S3.put_object(bucket, s3path, body, acl: :public_read, content_type: magic.mime_type),
{:ok, _} <- ExAws.request(s3req)
do
- path = LSGWeb.Router.Helpers.url(LSGWeb.Endpoint) <> "/files/#{s3path}"
+ path = NolaWeb.Router.Helpers.url(NolaWeb.Endpoint) <> "/files/#{s3path}"
sent = for {net, chan} <- target do
txt = "sent#{type}#{text} #{path}"
IRC.send_message_as(account, net, chan, txt)
@@ -176,7 +176,7 @@ defmodule LSG.Telegram do
@impl Telegram.ChatBot
def handle_info(info, %{room_state: room_state}) do
- {:ok, room_state} = LSG.TelegramRoom.handle_info(info, room_state)
+ {:ok, room_state} = Nola.TelegramRoom.handle_info(info, room_state)
{:ok, %{room_state: room_state}}
end