alt-art / TelegramBridge

Simple spigot plugin to make communication with groups on Telegram
https://modrinth.com/plugin/telegram-bridge
MIT License
6 stars 1 forks source link

telegram to Minecraft messages #4

Closed PystoyPlayer closed 8 months ago

PystoyPlayer commented 9 months ago

Chat FROM telegram to Minecraft doesn't work. Messages from Minecraft TO telegram work Shot (2024-03-03 at 10 38PM)@2x

alt-art commented 9 months ago

This problem is already fixed, I just need to make a release I am sorry for this

alt-art commented 9 months ago

The new release have some features, you will need to update the config file

PystoyPlayer commented 9 months ago

no problem works great now, thanks! Btw can you insert \n inside file %caption%, because when there's no caption an extra space appear IMAGE 2024-03-04 5:20:53 PM and what's the difference between video, attachment and media ?

alt-art commented 9 months ago

Some users may want to do other type of formatting on caption and maybe this will break with a new line, but I will do that because I think this is fine for now.

About the media types is something that I have to think about because telegram does not have a generalized away to check if something is a media and I have to check every single value on the API. I personally don't know what telegram thinks what a GIF is, and to check these things is not so trivial.

What I can tell you is that every type of media in the config file has a value in the API that matches what the media is. But the last type is just a fallback type that is not used for now because I don't check for all media types, only the specified on the array.

The idea is that if I find something specific that I think would be media, I can simply add it to my condition, and this will make the type the fallback value.

PystoyPlayer commented 9 months ago

Shot (2024-03-04 at 10 25PM)@2x

PystoyPlayer commented 9 months ago

btw how about to make a dynamic pinned message with current stats ? Sth like that: Shot (2024-03-04 at 10 38PM)@2x Used another plugin but it's a bit dead now

alt-art commented 9 months ago

Hmm, this is interesting. I think I could do this.

Can you explain to me how this works on the telegram side? I never used this plugin, nor did I know it was dead.

alt-art commented 9 months ago

Shot (2024-03-04 at 10 25PM)@2x

What did you send to give this error?

PystoyPlayer commented 9 months ago

Shot (2024-03-04 at 10 25PM)@2x

What did you send to give this error?

I suppose, that was after a user replied to a old message or a message that was sent while server was offline

PystoyPlayer commented 9 months ago

Hmm, this is interesting. I think I could do this.

Can you explain to me how this works on the telegram side? I never used this plugin, nor did I know it was dead.

I think you can try to contact the dev, words are clickable

alt-art commented 9 months ago

I suppose, that was after a user replied to a old message or a message that was sent while server was offline

Hmm, You replied with a media? Sticker o something? Because it is impossible, this value be null.

alt-art commented 9 months ago

Hmm, this is interesting. I think I could do this. Can you explain to me how this works on the telegram side? I never used this plugin, nor did I know it was dead.

I think you can try to contact the dev, word "dead" is clickable

I have checked the source code of the plugin and I think I could do something even better

PystoyPlayer commented 9 months ago

I suppose, that was after a user replied to a old message or a message that was sent while server was offline

Hmm, You replied with a media? Sticker o something? Because it is impossible, this value be null.

idk sry, will try again later

PystoyPlayer commented 9 months ago

Hmm, this is interesting. I think I could do this. Can you explain to me how this works on the telegram side? I never used this plugin, nor did I know it was dead.

I think you can try to contact the dev, word "dead" is clickable

I have checked the source code of the plugin and I think I could do something even better

Thank you very much. You're such an active and chic dev!

PystoyPlayer commented 9 months ago

Shot (2024-03-05 at 09 35PM)@2x

alt-art commented 9 months ago

If this error appears again, please restart your server and send me the logs. This error is difficult to debug. This plugin is new and I'm still checking if there are any problems.

PystoyPlayer commented 9 months ago

If this error appears again, please restart your server and send me the logs. This error is difficult to debug. This plugin is new and I'm still checking if there are any problems.

Sure. Also plugin disables (on restart) really slow almost 3 mins Shot (2024-03-05 at 10 33PM)@2x

alt-art commented 9 months ago

For me, it is the first to be disabled, maybe something with your sever? I have tested on spigot, but now my server is on paper.

alt-art commented 9 months ago

Keep in mind that the command /reload can cause problems, I have some code if the user uses /reload but the server community doesn't encourage you to use it.

PystoyPlayer commented 9 months ago

Keep in mind that the command /reload can cause problems, I have some code if the user uses /reload but the server community doesn't encourage you to use it.

I don't, that was full restart Current version: git-Purpur-2062 (MC: 1.20.1) - Latest

PystoyPlayer commented 9 months ago

idk what's the reason

[00:22:31 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:35 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:49 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:54 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:08 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:25 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:26 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:05 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:07 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:20 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:36 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:50 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:51 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:53 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:54 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:00 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:13 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:21 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:27 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:58 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
PystoyPlayer commented 9 months ago

btw a suggestion: messages about server status ("Server started", "Server stopped" etc, like in DiscordSRV)

alt-art commented 9 months ago

I will add this as optional, because sometimes this can be annoying.

alt-art commented 9 months ago

idk what's the reason

[00:22:31 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:35 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:49 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "replacement" is null
        at java.lang.String.replace(String.java:2961) ~[?:?]
        at org.altart.telegrambridge.utils.Format.string(Format.java:13) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.TelegramBot.onMessage(TelegramBot.java:122) ~[TelegramBridge-1.1.0.jar:?]
        at org.altart.telegrambridge.BotMessageHandler.onUpdateReceived(BotMessageHandler.java:52) ~[TelegramBridge-1.1.0.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-1.1.0.jar:?]
[00:22:54 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:08 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:25 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:23:26 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:05 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:07 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:20 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:36 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:50 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:51 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:53 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:24:54 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:00 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:13 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:21 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:27 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null
[00:25:58 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] null
java.lang.NullPointerException: null

I will debug on pupur to see if something is different

PystoyPlayer commented 8 months ago
[23:57:08 ERROR]: [org.telegram.telegrambots.updatesreceivers.DefaultBotSession] api.telegram.org:443 failed to respond
org.apache.http.NoHttpResponseException: api.telegram.org:443 failed to respond
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[httpcore-4.4.14.jar:4.4.14]
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[httpcore-4.4.14.jar:4.4.14]
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[httpcore-4.4.14.jar:4.4.14]
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[httpcore-4.4.14.jar:4.4.14]
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.13.jar:4.5.13]
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.13.jar:4.5.13]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$ReaderThread.getUpdatesFromServer(DefaultBotSession.java:249) ~[TelegramBridge-1.1.0.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$ReaderThread.run(DefaultBotSession.java:188) ~[TelegramBridge-1.1.0.jar:?]

sending another error just to make you know I suppose telegram servers were down that moment

alt-art commented 8 months ago

I made a test version of the pin feature that you can try to see if it works correctly.