diff options
author | href <href@random.sh> | 2021-09-01 10:30:18 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-01 10:30:18 +0200 |
commit | 75687711f35355bc30e4829439384aab28fcac6d (patch) | |
tree | 8f3256f472893c39720a684d390e890a152f7303 /lib/lsg/telegram.ex | |
parent | link: post_* callbacks; html & pdftitle. (diff) |
Commit all the changes that hasn't been committed + updates.
Diffstat (limited to 'lib/lsg/telegram.ex')
-rw-r--r-- | lib/lsg/telegram.ex | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/lsg/telegram.ex b/lib/lsg/telegram.ex index 7541b13..02d7115 100644 --- a/lib/lsg/telegram.ex +++ b/lib/lsg/telegram.ex @@ -3,8 +3,8 @@ defmodule LSG.Telegram do use Telegram.Bot, token: Keyword.get(Application.get_env(:lsg, :telegram, []), :key), - username: Keyword.get(Application.get_env(:lsg, :telegram), :nick, "beauttebot"), - purge: true + username: Keyword.get(Application.get_env(:lsg, :telegram, []), :nick, "beauttebot"), + purge: false def my_path() do "https://t.me/beauttebot" @@ -26,10 +26,10 @@ defmodule LSG.Telegram do _ -> "nil" end - #Handled message "1247435154:AAGnSSCnySn0RuVxy_SUcDEoOX_rbF6vdq0" %{"message" => + #Handled message "1247435154:AAGnSSCnySn0RuVxy_SUcDEoOX_rbF6vdq0" %{"message" => # %{"chat" => %{"first_name" => "J", "id" => 2075406, "type" => "private", "username" => "ahref"}, # "date" => 1591027272, "entities" => - # [%{"length" => 7, "offset" => 0, "type" => "bot_command"}], + # [%{"length" => 7, "offset" => 0, "type" => "bot_command"}], # "from" => %{"first_name" => "J", "id" => 2075406, "is_bot" => false, "language_code" => "en", "username" => "ahref"}, # "message_id" => 11, "text" => "/enable salope"}, "update_id" => 764148578} account = IRC.Account.find_meta_account("telegram-validation-code", String.downcase(key)) @@ -47,7 +47,7 @@ defmodule LSG.Telegram do send_message(m["chat"]["id"], text) end - #[debug] Unhandled update: %{"message" => + #[debug] Unhandled update: %{"message" => # %{"chat" => %{"first_name" => "J", "id" => 2075406, "type" => "private", "username" => "ahref"}, # "date" => 1591096015, # "from" => %{"first_name" => "J", "id" => 2075406, "is_bot" => false, "language_code" => "en", "username" => "ahref"}, @@ -155,7 +155,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 = "https://s3.wasabisys.com/#{bucket}/#{s3path}" + path = LSGWeb.Router.Helpers.url(LSGWeb.Endpoint) <> "/files/#{s3path}" sent = for {net, chan} <- target do user = IRC.UserTrack.find_by_account(net, account) nick = if(user, do: user.nick, else: account.name) @@ -210,7 +210,8 @@ defmodule LSG.Telegram do account: account, sender: %ExIRC.SenderInfo{nick: account.name}, replyfun: reply_fun, - trigger: IRC.Connection.extract_trigger(trigger_text) + trigger: IRC.Connection.extract_trigger(trigger_text), + at: nil } IO.puts("converted telegram to message: #{inspect message}") IRC.Connection.publish(message, ["message:private", "message:telegram"]) @@ -250,5 +251,3 @@ defmodule LSG.Telegram do text: "Hey! You sent me a message: #{inspect update}") end end - - |