Merge branch 'master' of ssh://git.mrbesen.de:2222/GamingServerGeraet/TelegramAPI

This commit is contained in:
mrbesen 2020-02-16 11:22:28 +01:00
commit ed13f4c9b0
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
3 changed files with 6 additions and 15 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.settings/
target/
bin/
.idea/

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -37,7 +37,7 @@ import de.mrbesen.telegram.objects.TUser.Status;
public class TelegramAPI implements Runnable {
private static final String API_URL = "https://api.telegram.org/bot";
private static final String TOKENREGEX = "^\\d{4,9}:[\\w-]{12,64}$";
private static final String TOKENREGEX = "^\\d{4,10}:[\\w-]{12,64}$";
private static final int TELEGRAMFILESIZELIMIT = 20000000;//20MB filesize https://core.telegram.org/bots/api#sending-files
public static final String APIVERSION = "3.8";//May 18, 2019
@ -329,6 +329,10 @@ public class TelegramAPI implements Runnable {
processUpdates(request("getUpdates", "offset=" + msg_offset + "&timeout=" + (longpolling ? updateInterval : 1), false));
} catch (IOException e) {
log.log("error getting updates.", e);
try {
Thread.sleep(100);
} catch(InterruptedException ignored) {}
}
}