Skip to content

Commit 6d7d08b

Browse files
authored
Merge pull request witnessmenow#12 from Nzbuu/bugfix/11
[witnessmenow#11] Fix spelling errors
2 parents 5f61bf0 + 0b89b51 commit 6d7d08b

File tree

11 files changed

+62
-56
lines changed

11 files changed

+62
-56
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@ Gets any pending messages from Telegram and stores them in bot.messages . Offset
7676

7777
Here are listed some examples to help you to build your own Bot:
7878

79+
- BulkMessages : sends messages to multiple subscribers (ESP8266 only).
80+
7981
- EchoBot : replies echoing your messages.
8082

8183
- FlashLedBot : Reacts to your command switching ON/OFF a GPIO.
8284

8385
- CustomKeyboard : Same as FlashLedBot but also uses a replyKeyboard
8486

87+
- UsingWifiManager : Same as FlashLedBot but also uses WiFiManager library to configure WiFi (ESP8266 only).
88+
8589

8690

8791
## License

examples/101/CustomKeyboard/CustomKeyboard.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ char password[] = "yyyyyyyy"; // your network key
1919
const int ledPin = 13;
2020

2121
// Initialize Telegram BOT
22-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
22+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2323

2424
WiFiSSLClient client;
2525
UniversalTelegramBot bot(BOTtoken, client);
@@ -57,7 +57,7 @@ void handleNewMessages(int numNewMessages) {
5757
}
5858

5959
if (text == "/start") {
60-
String welcome = "Wellcome from FlashLedBot, your personal Bot on ESP8266 board \n";
60+
String welcome = "Welcome from FlashLedBot, your personal Bot on Arduino 101\n";
6161
welcome = welcome + "/ledon : to switch the Led ON \n";
6262
welcome = welcome + "/ledoff : to switch the Led OFF \n";
6363
welcome = welcome + "/status : Returns current status of LED \n";
@@ -87,7 +87,7 @@ void setup() {
8787

8888
pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
8989
delay(10);
90-
digitalWrite(ledPin, HIGH); //initilase pin as off
90+
digitalWrite(ledPin, HIGH); // initialize pin as off
9191

9292
}
9393

@@ -96,11 +96,11 @@ void setup() {
9696
void loop() {
9797

9898
if (millis() > Bot_lasttime + Bot_mtbs) {
99-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
99+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
100100
while(numNewMessages) {
101101
Serial.println("got response");
102102
handleNewMessages(numNewMessages);
103-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
103+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
104104
}
105105
Bot_lasttime = millis();
106106
}

examples/101/EchoBot/EchoBot.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ char password[] = "yyyyyyyyy"; // your network key
1919

2020

2121
// Initialize Telegram BOT
22-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
22+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2323

2424
WiFiSSLClient client;
2525
UniversalTelegramBot bot(BOTtoken, client);
@@ -53,13 +53,13 @@ void setup() {
5353
void loop() {
5454

5555
if (millis() > Bot_lasttime + Bot_mtbs) {
56-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
56+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
5757
while(numNewMessages) {
5858
Serial.println("got response");
5959
for(int i=0; i<numNewMessages; i++) {
6060
bot.sendMessage(bot.messages[i].chat_id, bot.messages[i].text, "");
6161
}
62-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
62+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
6363
}
6464
Bot_lasttime = millis();
6565
}

examples/101/FlashledBot/FlashledBot.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ char password[] = "yyyyyyyy"; // your network key
2020
const int ledPin = 13;
2121

2222
// Initialize Telegram BOT
23-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
23+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2424

2525
WiFiSSLClient client;
2626
UniversalTelegramBot bot(BOTtoken, client);s
@@ -54,7 +54,7 @@ void handleNewMessages(int numNewMessages) {
5454
}
5555
}
5656
if (text == "/start") {
57-
String welcome = "Wellcome from FlashLedBot, your personal Bot on ESP8266 board \n";
57+
String welcome = "Welcome from FlashLedBot, your personal Bot on Arduino 101\n";
5858
welcome = welcome + "/ledon : to switch the Led ON \n";
5959
welcome = welcome + "/ledoff : to switch the Led OFF \n";
6060
welcome = welcome + "/status : Returns current status of LED \n";
@@ -84,18 +84,18 @@ void setup() {
8484

8585
pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
8686
delay(10);
87-
digitalWrite(ledPin, LOW); //initilase pin as off
87+
digitalWrite(ledPin, LOW); //initialize pin as off
8888

8989
}
9090

9191
void loop() {
9292

9393
if (millis() > Bot_lasttime + Bot_mtbs) {
94-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
94+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
9595
while(numNewMessages) {
9696
Serial.println("got response");
9797
handleNewMessages(numNewMessages);
98-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
98+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
9999
}
100100
Bot_lasttime = millis();
101101
}

examples/ESP8266/BulkMessages/BulkMessages.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ char ssid[] = "xxxxxxx"; // your network SSID (name)
1515
char password[] = "yyyyyyyy"; // your network key
1616

1717
// Initialize Telegram BOT
18-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
18+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
1919

2020
WiFiClientSecure client;
2121
UniversalTelegramBot bot(BOTtoken, client);
@@ -205,12 +205,12 @@ void setup() {
205205

206206
void loop() {
207207
if (millis() > Bot_lasttime + Bot_mtbs) {
208-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
208+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
209209

210210
while(numNewMessages) {
211211
Serial.println("got response");
212212
handleNewMessages(numNewMessages);
213-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
213+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
214214
}
215215

216216
Bot_lasttime = millis();

examples/ESP8266/CustomKeyboard/CustomKeyboard.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ char password[] = "yyyyyyyy"; // your network key
1919
const int ledPin = 13;
2020

2121
// Initialize Telegram BOT
22-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
22+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2323

2424
WiFiClientSecure client;
2525
UniversalTelegramBot bot(BOTtoken, client);
@@ -57,11 +57,11 @@ void handleNewMessages(int numNewMessages) {
5757
}
5858

5959
if (text == "/start") {
60-
String welcome = "Wellcome from FlashLedBot, your personal Bot on ESP8266 board \n";
61-
welcome = welcome + "/ledon : to switch the Led ON \n";
62-
welcome = welcome + "/ledoff : to switch the Led OFF \n";
63-
welcome = welcome + "/status : Returns current status of LED \n";
64-
welcome = welcome + "/options : returns the custom keyboard \n";
60+
String welcome = "Welcome from FlashLedBot, your personal Bot on ESP8266\n";
61+
welcome = welcome + "/ledon : to switch the Led ON\n";
62+
welcome = welcome + "/ledoff : to switch the Led OFF\n";
63+
welcome = welcome + "/status : Returns current status of LED\n";
64+
welcome = welcome + "/options : returns the custom keyboard\n";
6565
bot.sendMessage(chat_id, welcome, "Markdown");
6666
}
6767
}
@@ -92,7 +92,7 @@ void setup() {
9292

9393
pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
9494
delay(10);
95-
digitalWrite(ledPin, HIGH); //initilase pin as off
95+
digitalWrite(ledPin, HIGH); // initialize pin as off
9696

9797
}
9898

@@ -101,11 +101,11 @@ void setup() {
101101
void loop() {
102102

103103
if (millis() > Bot_lasttime + Bot_mtbs) {
104-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
104+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
105105
while(numNewMessages) {
106106
Serial.println("got response");
107107
handleNewMessages(numNewMessages);
108-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
108+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
109109
}
110110
Bot_lasttime = millis();
111111
}

examples/ESP8266/EchoBot/EchoBot.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ char password[] = "yyyyyyyyy"; // your network key
1818

1919

2020
// Initialize Telegram BOT
21-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
21+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2222

2323
WiFiClientSecure client;
2424
UniversalTelegramBot bot(BOTtoken, client);
@@ -57,13 +57,13 @@ void setup() {
5757
void loop() {
5858

5959
if (millis() > Bot_lasttime + Bot_mtbs) {
60-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
60+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
6161
while(numNewMessages) {
6262
Serial.println("got response");
6363
for(int i=0; i<numNewMessages; i++) {
6464
bot.sendMessage(bot.messages[i].chat_id, bot.messages[i].text, "");
6565
}
66-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
66+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
6767
}
6868
Bot_lasttime = millis();
6969
}

examples/ESP8266/FlashledBot/FlashledBot.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ char password[] = "yyyyyyyy"; // your network key
2020
const int ledPin = 13;
2121

2222
// Initialize Telegram BOT
23-
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get off Botfather)
23+
#define BOTtoken "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" // your Bot Token (Get from Botfather)
2424

2525
WiFiClientSecure client;
2626
UniversalTelegramBot bot(BOTtoken, client);
@@ -54,10 +54,10 @@ void handleNewMessages(int numNewMessages) {
5454
}
5555
}
5656
if (text == "/start") {
57-
String welcome = "Wellcome from FlashLedBot, your personal Bot on ESP8266 board \n";
58-
welcome = welcome + "/ledon : to switch the Led ON \n";
59-
welcome = welcome + "/ledoff : to switch the Led OFF \n";
60-
welcome = welcome + "/status : Returns current status of LED \n";
57+
String welcome = "Welcome from FlashLedBot, your personal Bot on ESP8266\n";
58+
welcome = welcome + "/ledon : to switch the Led ON\n";
59+
welcome = welcome + "/ledoff : to switch the Led OFF\n";
60+
welcome = welcome + "/status : Returns current status of LED\n";
6161
bot.sendMessage(chat_id, welcome, "Markdown");
6262
}
6363
}
@@ -89,18 +89,18 @@ void setup() {
8989

9090
pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
9191
delay(10);
92-
digitalWrite(ledPin, LOW); //initilase pin as off
92+
digitalWrite(ledPin, LOW); // initialize pin as off
9393

9494
}
9595

9696
void loop() {
9797

9898
if (millis() > Bot_lasttime + Bot_mtbs) {
99-
int numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
99+
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
100100
while(numNewMessages) {
101101
Serial.println("got response");
102102
handleNewMessages(numNewMessages);
103-
numNewMessages = bot.getUpdates(bot.last_message_recived + 1);
103+
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
104104
}
105105
Bot_lasttime = millis();
106106
}

examples/ESP8266/UsingWiFiManager/UsingWiFiManager.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ void handleNewMessages(int numNewMessages) {
7878
}
7979
}
8080
if (text == "/start") {
81-
String welcome = "Wellcome from FlashLedBot, your personal Bot on ESP8266 board \n";
82-
welcome = welcome + "/ledon : to switch the Led ON \n";
83-
welcome = welcome + "/ledoff : to switch the Led OFF \n";
84-
welcome = welcome + "/status : Returns current status of LED \n";
81+
String welcome = "Welcome from FlashLedBot, your personal Bot on ESP8266\n";
82+
welcome = welcome + "/ledon : to switch the Led ON\n";
83+
welcome = welcome + "/ledoff : to switch the Led OFF\n";
84+
welcome = welcome + "/status : Returns current status of LED\n";
8585
bot->sendMessage(chat_id, welcome, "Markdown");
8686
}
8787
}
@@ -95,7 +95,7 @@ void setup() {
9595
pinMode(resetConfigPin, INPUT);
9696
pinMode(ledPin, OUTPUT); // initialize digital ledPin as an output.
9797
delay(10);
98-
digitalWrite(ledPin, LOW); //initilase pin as off
98+
digitalWrite(ledPin, LOW); // initialize pin as off
9999

100100
Serial.println("read bot token");
101101
readBotTokenFromEeprom(0);
@@ -133,11 +133,11 @@ void loop() {
133133
delay(5000);
134134
}
135135
if (millis() > Bot_lasttime + Bot_mtbs) {
136-
int numNewMessages = bot->getUpdates(bot->last_message_recived + 1);
136+
int numNewMessages = bot->getUpdates(bot->last_message_received + 1);
137137
while(numNewMessages) {
138138
Serial.println("got response");
139139
handleNewMessages(numNewMessages);
140-
numNewMessages = bot->getUpdates(bot->last_message_recived + 1);
140+
numNewMessages = bot->getUpdates(bot->last_message_received + 1);
141141
}
142142
Bot_lasttime = millis();
143143
}

src/UniversalTelegramBot.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl
6969

7070
String response = "";
7171
long now;
72-
bool responseRecieved;
72+
bool responseReceived;
7373
// Connect with api.telegram.org
7474
if (client->connect(HOST, SSL_PORT)) {
7575
// POST URI
@@ -92,7 +92,7 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl
9292
int ch_count=0;
9393
char c;
9494
now=millis();
95-
responseRecieved=false;
95+
responseReceived=false;
9696
while (millis()-now<1500) {
9797
while (client->available()) {
9898
char c = client->read();
@@ -101,9 +101,9 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl
101101
response=response+c;
102102
ch_count++;
103103
}
104-
responseRecieved=true;
104+
responseReceived=true;
105105
}
106-
if (responseRecieved) {
106+
if (responseReceived) {
107107
if (_debug) {
108108
Serial.println();
109109
Serial.println(response);
@@ -120,7 +120,7 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl
120120

121121
bool UniversalTelegramBot::getMe() {
122122
String command="bot"+_token+"/getMe";
123-
String response = sendGetToTelegram(command); //recieve reply from telegram.org
123+
String response = sendGetToTelegram(command); //receive reply from telegram.org
124124
DynamicJsonBuffer jsonBuffer;
125125
JsonObject& root = jsonBuffer.parseObject(response);
126126
if(root.success()) {
@@ -149,9 +149,9 @@ bool UniversalTelegramBot::getMe() {
149149

150150
int UniversalTelegramBot::getUpdates(long offset) {
151151

152-
if (_debug) Serial.println("GET Update Messages ");
152+
if (_debug) Serial.println("GET Update Messages");
153153
String command="bot"+_token+"/getUpdates?offset="+String(offset)+"&limit="+String(HANDLE_MESSAGES);
154-
String response = sendGetToTelegram(command); //recieve reply from telegram.org
154+
String response = sendGetToTelegram(command); //receive reply from telegram.org
155155
if (response != "") {
156156
if (_debug) {
157157
Serial.print("incoming message length");
@@ -174,8 +174,8 @@ int UniversalTelegramBot::getUpdates(long offset) {
174174
int newMessageIndex = 0;
175175
for(int i=0; i < resultArrayLength; i++){
176176
int update_id = root["result"][i]["update_id"];
177-
if(last_message_recived != update_id) {
178-
last_message_recived = update_id;
177+
if(last_message_received != update_id) {
178+
last_message_received = update_id;
179179
String text = root["result"][i]["message"]["text"];
180180
String date = root["result"][i]["message"]["date"];
181181
String chat_id = root["result"][i]["message"]["chat"]["id"];
@@ -213,7 +213,7 @@ int UniversalTelegramBot::getUpdates(long offset) {
213213
bool UniversalTelegramBot::sendSimpleMessage(String chat_id, String text, String parse_mode) {
214214

215215
bool sent=false;
216-
if (_debug) Serial.println("SEND Simple Message ");
216+
if (_debug) Serial.println("SEND Simple Message");
217217
long sttime=millis();
218218
if (text!="") {
219219
while (millis()<sttime+8000) { // loop for a while to send the message
@@ -287,7 +287,7 @@ bool UniversalTelegramBot::sendMessageWithReplyKeyboard(String chat_id, String t
287287
bool UniversalTelegramBot::sendPostMessage(JsonObject& payload) {
288288

289289
bool sent=false;
290-
if (_debug) Serial.println("SEND Post Message ");
290+
if (_debug) Serial.println("SEND Post Message");
291291
long sttime=millis();
292292
if (payload.containsKey("text")) {
293293
while (millis()<sttime+8000) { // loop for a while to send the message

0 commit comments

Comments
 (0)