Skip to content

Commit 5c1dad5

Browse files
committed
Re-write there is only one common class for all architecture types and the client is passed in
1 parent 7a7740b commit 5c1dad5

24 files changed

+176
-385
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ The downloaded code can be included as a new library into the IDE selecting the
2727
You also have to install the ArduinoJson library written by [Benoît Blanchon](https://github.com/bblanchon).
2828
Available [here](https://github.com/bblanchon/ArduinoJson).
2929

30-
If your board is ESP8266 (e.g. WeMos v2 Mini) based include the following:
30+
Include UniversalTelegramBot in your project:
3131

32-
#include <ESP8266TelegramBOT.h>
32+
#include <UniversalTelegramBot.h>
3333

34-
or if its 101 based include:
34+
and pass it a Bot token and a SSL Client (See the examples for more details)
3535

36-
#include <101TelegramBOT.h>
36+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
37+
WiFiClientSecure client;
38+
UniversalTelegramBot bot(BOTtoken, client);
3739

38-
*NOTE:* 101TelegramBOT has not been tested as I do not have a compatible board. If you can help please let me know!
40+
*NOTE:* This library has not been tested with the 101 boards as I do not have a compatible board. If you can help please let me know!
3941

4042
## Getting started
4143

examples/101/CustomKeyboard/CustomKeyboard.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*******************************************************************
2-
* An example of how to use a custom reply keyboard using *
3-
* 101TelegramBOT. *
2+
* An example of how to use a custom reply keyboard. *
3+
* *
44
* *
55
* written by Brian Lough *
66
*******************************************************************/
77

8+
#include <WiFiSSLClient.h>
89
#include <WiFi101.h>
9-
#include <101TelegramBOT.h>
10+
#include <UniversalTelegramBot.h>
1011

1112

1213
// Initialize Wifi connection to the router
@@ -20,7 +21,8 @@ const int ledPin = 13;
2021
// Initialize Telegram BOT
2122
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
2223

23-
101TelegramBOT bot(BOTtoken);
24+
WiFiSSLClient client;
25+
UniversalTelegramBot bot(BOTtoken, client);
2426

2527
int Bot_mtbs = 1000; //mean time between scan messages
2628
long Bot_lasttime; //last time messages' scan has been done

examples/101/CustomKeyboard/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#101 - Custom Keyboard bot
22

3-
This is an example of how to use custom reply keyboards using the 101TelegramBOT
3+
This is an example of how to use custom reply keyboards on a 101 based board.
44

5-
The application will turn on and off an led based on commands received via telegram
5+
The application will turn on and off an LED based on commands received via telegram.
66

77
NOTE: You will need to enter your SSID, password and bot Token for the example to work.
88

99
Application written by [Brian Lough](https://github.com/witnessmenow)
1010

1111

12-
1312
## License
1413

1514
You may copy, distribute and modify the software provided that modifications are described and licensed for free under [LGPL-3](http://www.gnu.org/licenses/lgpl-3.0.html). Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under [LGPL-3](http://www.gnu.org/licenses/lgpl-3.0.html), but applications that use the library don't have to be.

examples/101/EchoBot/EchoBot.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/*******************************************************************
22
* An example of bot that echos back any messages received *
3-
* using 101TelegramBOT. *
3+
* using A101TelegramBot. *
44
* *
55
* written by Giacarlo Bacchio (Gianbacchio on Github) *
66
* adapted by Brian Lough *
77
*******************************************************************/
88

99

10+
#include <WiFiSSLClient.h>
1011
#include <WiFi101.h>
11-
#include <101TelegramBOT.h>
12+
#include <UniversalTelegramBot.h>
1213

1314

1415
// Initialize Wifi connection to the router
@@ -19,7 +20,9 @@ char password[] = "yyyyyyyyy"; // your network key
1920

2021
// Initialize Telegram BOT
2122
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
22-
101TelegramBOT bot(BOTtoken);
23+
24+
WiFiSSLClient client;
25+
UniversalTelegramBot bot(BOTtoken, client);
2326

2427
int Bot_mtbs = 1000; //mean time between scan messages
2528
long Bot_lasttime; //last time messages' scan has been done

examples/101/EchoBot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#101 - Echo Bot
22

3-
This is a basic example of how to use 101TelegramBOT.
3+
This is a basic example of how to use UniversalTelegramBot on 101 based boards.
44

55
The application will echo an message it received back to the user.
66

examples/101/EchoBotWithPost/EchoBotWithPost.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/*******************************************************************
22
* An example of bot that echos back any messages received *
3-
* using 101TelegramBOT. *
3+
* using A101TelegramBot. *
44
* *
55
* written by Brian Lough *
66
*******************************************************************/
77

88

9+
#include <WiFiSSLClient.h>
910
#include <WiFi101.h>
10-
#include <101TelegramBOT.h>
11+
#include <UniversalTelegramBot.h>
1112

1213

1314
// Initialize Wifi connection to the router
@@ -17,7 +18,9 @@ char password[] = "yyyyyyyyy"; // your network key
1718

1819
// Initialize Telegram BOT
1920
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
20-
101TelegramBOT bot(BOTtoken);
21+
22+
WiFiSSLClient client;
23+
UniversalTelegramBot bot(BOTtoken, client);
2124

2225
int Bot_mtbs = 1000; //mean time between scan messages
2326
long Bot_lasttime; //last time messages' scan has been done

examples/101/EchoBotWithPost/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#101 - Echo Bot with post
22

3-
This is a basic example of how to use sendPostMessage functionality of 101TelegramBOT.
3+
This is a basic example of how to use sendPostMessage functionality of UniversalTelegramBot for 101 based boards.
44

55
sendPostMessage allows the more advanced options of the Telegram Api to be used (see CustomKeyboard example for how to use keyboards).
66

examples/101/FlashledBot/FlashledBot.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
/*******************************************************************
22
* An example of bot that receives commands and turns on and off *
3-
* an led using using 101TelegramBOT. *
3+
* an led using using A101TelegramBot. *
44
* *
55
* written by Giacarlo Bacchio (Gianbacchio on Github) *
66
* adapted by Brian Lough *
77
*******************************************************************/
88

9+
#include <WiFiSSLClient.h>
910
#include <WiFi101.h>
10-
#include <101TelegramBOT.h>
11+
#include <UniversalTelegramBot.h>
1112

1213

1314
// Initialize Wifi connection to the router
@@ -21,7 +22,8 @@ const int ledPin = 13;
2122
// Initialize Telegram BOT
2223
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
2324

24-
101TelegramBOT bot(BOTtoken);
25+
WiFiSSLClient client;
26+
UniversalTelegramBot bot(BOTtoken, client);s
2527

2628
int Bot_mtbs = 1000; //mean time between scan messages
2729
long Bot_lasttime; //last time messages' scan has been done

examples/101/FlashledBot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#101 - Flashled Bot
22

3-
This is a basic example of how to receive commands using 101TelegramBOT.
3+
This is a basic example of how to receive commands using UniversalTelegramBot for 101 based boards.
44

5-
The application will turn on and off an led based on commands received via telegram
5+
The application will turn on and off an LED based on commands received via telegram.
66

77
Application originally written by [Giancarlo Bacchio]([email protected]) for [ESP8266-TelegramBot library](https://github.com/Gianbacchio/ESP8266-TelegramBot)
88

examples/ESP8266/CustomKeyboard/CustomKeyboard.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*******************************************************************
2-
* An example of how to use a custom reply keyboard using *
3-
* ESP8266TelegramBot. *
2+
* An example of how to use a custom reply keyboard. *
3+
* *
44
* *
55
* written by Brian Lough *
66
*******************************************************************/
77

88
#include <ESP8266WiFi.h>
99
#include <WiFiClientSecure.h>
10-
#include <ESP8266TelegramBOT.h>
10+
#include <UniversalTelegramBot.h>
1111

1212

1313
// Initialize Wifi connection to the router
@@ -21,7 +21,8 @@ const int ledPin = 13;
2121
// Initialize Telegram BOT
2222
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
2323

24-
ESP8266TelegramBOT bot(BOTtoken);
24+
WiFiClientSecure client;
25+
UniversalTelegramBot bot(BOTtoken, client);
2526

2627
int Bot_mtbs = 1000; //mean time between scan messages
2728
long Bot_lasttime; //last time messages' scan has been done

0 commit comments

Comments
 (0)