Skip to content

Commit

Permalink
Api version 6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Nov 8, 2022
1 parent 4db7532 commit 1e040be
Show file tree
Hide file tree
Showing 55 changed files with 1,062 additions and 59 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambots:6.1.0'
implementation 'org.telegram:telegrambots:6.3.0'
```

3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.1.0)
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.1.0)
3. Using Jitpack from [here](https://jitpack.io/#rubenlagus/TelegramBots/6.3.0)
4. Download the jar(including all dependencies) from [here](https://mvnrepository.com/artifact/org.telegram/telegrambots/6.3.0)

In order to use Long Polling mode, just create your own bot extending `org.telegram.telegrambots.bots.TelegramLongPollingBot`.

Expand Down
4 changes: 2 additions & 2 deletions TelegramBots.wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ First you need to acquire the library and add it to your project. There are seve
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```
* With **Gradle**:

```gradle
implementation 'org.telegram:telegrambots:6.1.0'
implementation 'org.telegram:telegrambots:6.3.0'
```

2. Don't like the **Maven Central Repository**? It can also be grabbed from [Jitpack](https://jitpack.io/#rubenlagus/TelegramBots).
Expand Down
4 changes: 2 additions & 2 deletions TelegramBots.wiki/abilities/Simple-Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ As with any Java project, you will need to set your dependencies.
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```
* **Gradle**
```gradle
implementation 'org.telegram:telegrambots-abilities:6.1.0'
implementation 'org.telegram:telegrambots-abilities:6.3.0'
```
* [JitPack](https://jitpack.io/#rubenlagus/TelegramBots)

Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>6.1.0</version>
<version>6.3.0</version>

<modules>
<module>telegrambots</module>
Expand Down Expand Up @@ -67,13 +67,13 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

<junit.version>5.8.2</junit.version>
<mockito.version>4.6.1</mockito.version>
<mockitojupiter.version>4.6.1</mockitojupiter.version>
<jacksonanotation.version>2.13.2</jacksonanotation.version>
<jackson.version>2.13.2.2</jackson.version>
<json.version>20220320</json.version>
<slf4j.version>1.7.36</slf4j.version>
<junit.version>5.9.1</junit.version>
<mockito.version>4.8.1</mockito.version>
<mockitojupiter.version>4.8.1</mockitojupiter.version>
<jacksonanotation.version>2.14.0</jacksonanotation.version>
<jackson.version>2.14.0</jackson.version>
<json.version>20220924</json.version>
<slf4j.version>2.0.3</slf4j.version>
<jakarta.annotation.version>2.1.1</jakarta.annotation.version>
<lombok.version>1.18.24</lombok.version>
<guava.version>31.1-jre</guava.version>
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-abilities/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-abilities</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```

**Gradle**

```gradle
implementation 'org.telegram:telegrambots-abilities:6.1.0'
implementation 'org.telegram:telegrambots-abilities:6.3.0'
```

**JitPack** - [JitPack](https://jitpack.io/#rubenlagus/TelegramBots/v5.0.1)
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-abilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</parent>

<artifactId>telegrambots-abilities</artifactId>
Expand Down Expand Up @@ -84,7 +84,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-chat-session-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Usage
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-chat-session-bot</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```

**Gradle**

```gradle
implementation 'org.telegram:telegrambots-chat-session-bot:6.1.0'
implementation 'org.telegram:telegrambots-chat-session-bot:6.3.0'
```

Motivation
Expand Down
6 changes: 3 additions & 3 deletions telegrambots-chat-session-bot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</parent>

<artifactId>telegrambots-chat-session-bot</artifactId>
Expand Down Expand Up @@ -76,15 +76,15 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<shiro.version>1.9.1</shiro.version>
<shiro.version>1.10.0</shiro.version>
</properties>

<dependencies>

<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-core -->
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambotsextensions</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambotsextensions:6.1.0'
implementation 'org.telegram:telegrambotsextensions:6.3.0'
```
4 changes: 2 additions & 2 deletions telegrambots-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</parent>

<artifactId>telegrambotsextensions</artifactId>
Expand Down Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion telegrambots-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>6.1.0</version>
<version>6.3.0</version>
</parent>

<artifactId>telegrambots-meta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class CopyMessage extends BotApiMethod<MessageId> {
public static final String PATH = "copyMessage";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String FROMCHATID_FIELD = "from_chat_id";
private static final String MESSAGEID_FIELD = "message_id";
private static final String CAPTION_FIELD = "caption";
Expand All @@ -56,6 +57,12 @@ public class CopyMessage extends BotApiMethod<MessageId> {
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(FROMCHATID_FIELD)
@NonNull
private String fromChatId; ///< Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ForwardMessage extends BotApiMethodMessage {
public static final String PATH = "forwardmessage";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";
private static final String FROMCHATID_FIELD = "from_chat_id";
private static final String MESSAGEID_FIELD = "message_id";
private static final String DISABLENOTIFICATION_FIELD = "disable_notification";
Expand All @@ -42,6 +43,12 @@ public class ForwardMessage extends BotApiMethodMessage {
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels)
/**
* Unique identifier for the target message thread (topic) of the forum;
* for forum supergroups only
*/
@JsonProperty(MESSAGETHREADID_FIELD)
private Integer messageThreadId;
@JsonProperty(FROMCHATID_FIELD)
@NonNull
private String fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package org.telegram.telegrambots.meta.api.methods.forum;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Tolerate;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

/**
* @author Ruben Bermudez
* @version 6.3
* Use this method to close an open topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have
* the can_manage_topics administrator rights, unless it is the creator of the topic.
*
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CloseForumTopic extends BotApiMethodBoolean {
public static final String PATH = "closeForumTopic";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGETHREADID_FIELD = "message_thread_id";

/**
* Unique identifier for the target chat or username
* of the target supergroup (in the format @supergroupusername)
*/
@JsonProperty(CHATID_FIELD)
@NonNull
private String chatId;
/**
* Unique identifier for the target message thread of the forum topic
*/
@JsonProperty(MESSAGETHREADID_FIELD)
@NonNull
private Integer messageThreadId;

@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}

@Override
public void validate() throws TelegramApiValidationException {
if (chatId.isEmpty()) {
throw new TelegramApiValidationException("ChatId can't be empty", this);
}
if (messageThreadId <= 0) {
throw new TelegramApiValidationException("Message Thread Id can't be empty", this);
}
}

@Override
public String getMethod() {
return PATH;
}

public static class CloseForumTopicBuilder {

@Tolerate
public CloseForumTopicBuilder chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}
Loading

0 comments on commit 1e040be

Please sign in to comment.