Skip to content

(In Process for Issue#15) Fixed Lesson 1 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Lesson 1/src/Main.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
public class Main {
public static void main(String[] args) {
// Initialize Api Context
ApiContextInitializer.init();

// Instantiate Telegram Bots API
TelegramBotsApi botsApi = new TelegramBotsApi();
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);

// Register our bot
try {
Expand Down
42 changes: 6 additions & 36 deletions chapter1.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,51 +129,29 @@ public void onUpdateReceived(Update update) {
Good! But how do I run the bot? Well, its a good question. Lets save that file and open `Main.java`. This file will instantiate TelegramBotsApi and register our new bot. It will look like this:

```java
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.TelegramBotsApi;
import org.telegram.telegrambots.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
public class Main {
public static void main(String[] args) {

// TODO Initialize Api Context

// TODO Instantiate Telegram Bots API

// TODO Register our bot
}
}
```

Now, lets initialize Api Context

```java
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.TelegramBotsApi;
import org.telegram.telegrambots.exceptions.TelegramApiException;
public class Main {
public static void main(String[] args) {
// Initialize Api Context
ApiContextInitializer.init();


// TODO Instantiate Telegram Bots API

// TODO Register our bot

}
}
```

Instantiate Telegram Bots API:

```java
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.TelegramBotsApi;
import org.telegram.telegrambots.exceptions.TelegramApiException;
public class Main {
public static void main(String[] args) {
// Initialize Api Context
ApiContextInitializer.init();
// Instantiate Telegram Bots API
TelegramBotsApi botsApi = new TelegramBotsApi();
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);

// TODO Register our bot
}
Expand All @@ -183,16 +161,12 @@ public class Main {
And register our bot:

```java
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.TelegramBotsApi;
import org.telegram.telegrambots.exceptions.TelegramApiException;
public class Main {
public static void main(String[] args) {
// Initialize Api Context
ApiContextInitializer.init();

// Instantiate Telegram Bots API
TelegramBotsApi botsApi = new TelegramBotsApi();
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);

// Register our bot
try {
Expand All @@ -209,16 +183,12 @@ Here is all our files:
> `src/Main.java`

```java
import org.telegram.telegrambots.ApiContextInitializer;
import org.telegram.telegrambots.TelegramBotsApi;
import org.telegram.telegrambots.exceptions.TelegramApiException;
public class Main {
public static void main(String[] args) {
// Initialize Api Context
ApiContextInitializer.init();

// Instantiate Telegram Bots API
TelegramBotsApi botsApi = new TelegramBotsApi();
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);

// Register our bot
try {
Expand Down