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

incorrect default config #17

Closed PystoyPlayer closed 5 months ago

PystoyPlayer commented 5 months ago
[20:55:27 ERROR]: [TelegramBridge] Error loading config: For input string: "null"
[20:55:27 ERROR]: [TelegramBridge] java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[20:55:27 ERROR]: [TelegramBridge] java.base/java.lang.Integer.parseInt(Integer.java:668)
[20:55:27 ERROR]: [TelegramBridge] java.base/java.lang.Integer.valueOf(Integer.java:999)
[20:55:27 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config$Chat.chatsFrom(Config.java:166)
[20:55:27 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config.load(Config.java:56)
[20:55:27 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config.<init>(Config.java:40)
[20:55:27 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.TelegramBridge.onEnable(TelegramBridge.java:35)
[20:55:27 ERROR]: [TelegramBridge] org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281)
[20:55:27 ERROR]: [TelegramBridge] io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189)
[20:55:27 ERROR]: [TelegramBridge] io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[20:55:27 ERROR]: [TelegramBridge] org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[20:55:27 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:656)
[20:55:27 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:567)
[20:55:27 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:640)
[20:55:27 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:439)
[20:55:27 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:345)
[20:55:27 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1116)
[20:55:27 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[20:55:27 ERROR]: [TelegramBridge] java.base/java.lang.Thread.run(Thread.java:840)
[20:55:27 ERROR]: [TelegramBridge] Please set your bot token and chat id in the config file
[20:55:27 INFO]: [TelegramBridge] Disabling TelegramBridge v2.1.2
PystoyPlayer commented 5 months ago

I set it up tho

PystoyPlayer commented 5 months ago

ok so I replaced default config with the one from your GitHub and it's working now but giving some strange errors in console

tbreload
[21:23:44 ERROR]: [TelegramBridge] Error loading config: For input string: "null"
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Integer.parseInt(Integer.java:668)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Integer.valueOf(Integer.java:999)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config$Chat.chatsFrom(Config.java:162)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config.load(Config.java:56)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.commands.ReloadCommand.onCommand(ReloadCommand.java:13)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1001)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchServerCommand(CraftServer.java:986)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.bf(DedicatedServer.java:540)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:487)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1420)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1191)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Thread.run(Thread.java:840)
[21:23:44 INFO]: Config reloaded!
PystoyPlayer commented 5 months ago

also when a user has an invisible name:

[21:59:00 INFO]: [TelegramBridge] Telegram message received from suhddude: это я
это я
я скринил😊☺️
[22:00:46 INFO]: [TelegramBridge] Telegram message received from null: гсоподи
[22:00:46 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-2.1.2.jar:?]
        at org.altart.telegrambridge.bot.feature.MessageListener.onUpdateReceived(MessageListener.java:83) ~[TelegramBridge-2.1.2.jar:?]
        at org.altart.telegrambridge.bot.TelegramBot.lambda$onUpdateReceived$1(TelegramBot.java:83) ~[TelegramBridge-2.1.2.jar:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
        at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) ~[?:?]
        at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754) ~[?:?]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
        at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:686) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) ~[?:?]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765) ~[?:?]
        at org.altart.telegrambridge.bot.TelegramBot.onUpdateReceived(TelegramBot.java:83) ~[TelegramBridge-2.1.2.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) ~[TelegramBridge-2.1.2.jar:?]
        at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:312) ~[TelegramBridge-2.1.2.jar:?]
alt-art commented 5 months ago

how a user can have an invisible name?

alt-art commented 5 months ago

ok so I replaced default config with the one from your GitHub and it's working now but giving some strange errors in console

tbreload
[21:23:44 ERROR]: [TelegramBridge] Error loading config: For input string: "null"
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Integer.parseInt(Integer.java:668)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Integer.valueOf(Integer.java:999)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config$Chat.chatsFrom(Config.java:162)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.config.Config.load(Config.java:56)
[21:23:44 ERROR]: [TelegramBridge] TelegramBridge-2.1.2.jar//org.altart.telegrambridge.commands.ReloadCommand.onCommand(ReloadCommand.java:13)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1001)
[21:23:44 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchServerCommand(CraftServer.java:986)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.bf(DedicatedServer.java:540)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:487)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1420)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1191)
[21:23:44 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[21:23:44 ERROR]: [TelegramBridge] java.base/java.lang.Thread.run(Thread.java:840)
[21:23:44 INFO]: Config reloaded!

Hmm… I know what this is, I thought this wouldn't be a problem I will resolve this.

PystoyPlayer commented 5 months ago

how a user can have an invisible name?

idk, I believe they use some special characters. Telegram doesn't show them either

PystoyPlayer commented 5 months ago

how a user can have an invisible name?

idk, I believe they use some special characters. Telegram doesn't show them either

ahh I understood although nicknames can be invisible with some special characters, you don't rely on Nicknames but on @ usernames which can be toggled off

Example:

CleanShot 2024-06-14 at 5  06 49@2x CleanShot 2024-06-14 at 5  06 43@2x Both users have invisible nicknames but one of them has also disabled his username

alt-art commented 5 months ago

@PystoyPlayer my telegram doesn't have option to disable my @ username I will add some fallbacks but maybe could be something wrong

PystoyPlayer commented 5 months ago

Are you sure ?

[21:19:29 INFO]: [TelegramBridge] Enabling TelegramBridge v2.1.3
[21:19:29 ERROR]: [TelegramBridge] Error loading config: class java.lang.Long cannot be cast to class java.lang.String (java.lang.Long and java.lang.String are in module java.base of loader 'bootstrap')
[21:19:29 ERROR]: [TelegramBridge] TelegramBridge-2.1.3.jar//org.altart.telegrambridge.config.Config$Chat.chatsFrom(Config.java:159)
[21:19:29 ERROR]: [TelegramBridge] TelegramBridge-2.1.3.jar//org.altart.telegrambridge.config.Config.load(Config.java:56)
[21:19:29 ERROR]: [TelegramBridge] TelegramBridge-2.1.3.jar//org.altart.telegrambridge.config.Config.<init>(Config.java:40)
[21:19:29 ERROR]: [TelegramBridge] TelegramBridge-2.1.3.jar//org.altart.telegrambridge.TelegramBridge.onEnable(TelegramBridge.java:35)
[21:19:29 ERROR]: [TelegramBridge] org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281)
[21:19:29 ERROR]: [TelegramBridge] io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189)
[21:19:29 ERROR]: [TelegramBridge] io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[21:19:29 ERROR]: [TelegramBridge] org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[21:19:29 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:656)
[21:19:29 ERROR]: [TelegramBridge] org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:567)
[21:19:29 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:640)
[21:19:29 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:439)
[21:19:29 ERROR]: [TelegramBridge] net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:345)
[21:19:29 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1116)
[21:19:29 ERROR]: [TelegramBridge] net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[21:19:29 ERROR]: [TelegramBridge] java.base/java.lang.Thread.run(Thread.java:840)
[21:19:29 ERROR]: [TelegramBridge] Please set your bot token and chat id in the config file
[21:19:29 INFO]: [TelegramBridge] Disabling TelegramBridge v2.1.3

default config is still wrong Shot 18-06-2024 at 09 15PM@2x

alt-art commented 5 months ago

What you are seeing is the default yes, I made some changes to make the default configuration not be necessary

PystoyPlayer commented 5 months ago

ok so I just put token and id in ' ' and it worked

alt-art commented 5 months ago

On documentation you can see the fields, I will clarify this in the docs

PystoyPlayer commented 5 months ago

btw why pinned message is in config, not in lang folder ?

alt-art commented 5 months ago

Once you put the chat id and bot token it will work

alt-art commented 5 months ago

But the fields that is not set will be the default

PystoyPlayer commented 5 months ago

Once you put the chat id and bot token it will work

yeah but it's quite inconvenient that I need to search for the fields that I may add to the config by myself. Idk maybe not

alt-art commented 5 months ago

btw why pinned message is in config, not in lang folder ?

Because it depends more of the server and what customization the server owner will like to have, the telegram pinned message will be the same for everyone anyway

PystoyPlayer commented 5 months ago

Because it depends more of the server and what customization the server owner will like to have, the telegram pinned message will be the same for everyone anyway

understandable

alt-art commented 5 months ago

Once you put the chat id and bot token it will work

yeah but it's quite inconvenient that I need to search for the fields that I may add to the config by myself. Idk maybe not

I know this can be strange, I am doing this because can be quite a mess to manage those config files, and I want the user to not have to think too much about this