Skip to content

MYnimef/telegrambot-java

Repository files navigation

Supported version

API for creating telegram bot

This API uses Rubenlagus' library for Java.

Adding to your project

To add this API to your project you need to add dependency.

MAVEN

If you use maven, add to pom.xml following text:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.MYnimef</groupId>
    <artifactId>telegrambot-java</artifactId>
    <version>0.0.2</version>
</dependency>

GRADLE

If you use gradle, add to build.gradle following text:

repositories { 
    
    ...
    
    maven { 
        url 'https://jitpack.io'
    }
}

dependencies {
    
    ...
    
    implementation 'com.github.MYnimef:telegrambot-java:0.0.2'
}

Possible problems

If your bot receives/sends messages with text that isn't supported in ANSII, you should add to build.gradle the following lines:

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

Bot initialization

public class Main {
    public static void main(String[] args) {
        IBot bot = new BotCreator(
                "token",
                "username"
        )
                .start();
    }
}

Bot customization

Credits