Skip to content

Commit dde53ba

Browse files
committed
Improved Bulk Messages example
1 parent a7b054b commit dde53ba

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

examples/ESP8266/BulkMessages/BulkMessages.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ void handleNewMessages(int numNewMessages) {
4343

4444
if (text == "/start") {
4545
if (addSubscribedUser(chat_id, from_name)) {
46-
bot.sendMessage(chat_id, "Welcome to BulkMessages example, " + from_name, "");
46+
String welcome = "Welcome to Universal Arduino Telegram Bot library, " + from_name + ".\n";
47+
welcome += "This is Bulk Messages example.\n\n";
48+
welcome += "/showallusers : show all subscribed users\n";
49+
welcome += "/testbulkmessage : send test message to subscribed users\n";
50+
welcome += "/removeallusers : remove all subscribed users\n";
51+
welcome += "/stop : unsubscribe from bot\n";
52+
bot.sendMessage(chat_id, welcome, "Markdown");
4753
} else {
4854
bot.sendMessage(chat_id, "Something wrong, please try again (later?)", "");
4955
}
@@ -61,7 +67,7 @@ void handleNewMessages(int numNewMessages) {
6167
sendMessageToAllSubscribedUsers("ATTENTION, this is bulk message for all subscribed users!");
6268
}
6369

64-
if (text == "\/showallusers") {
70+
if (text == "/showallusers") {
6571
File subscribedUsersFile = SPIFFS.open("/"+subscribed_users_filename, "r");
6672

6773
if (!subscribedUsersFile) {
@@ -78,7 +84,7 @@ void handleNewMessages(int numNewMessages) {
7884
}
7985
}
8086

81-
if (text == "\/removeallusers") {
87+
if (text == "/removeallusers") {
8288
if (SPIFFS.remove("/"+subscribed_users_filename)) {
8389
bot.sendMessage(chat_id, "All users removed", "");
8490
} else {
@@ -180,7 +186,7 @@ void sendMessageToAllSubscribedUsers(String message) {
180186
}
181187

182188
void setup() {
183-
Serial.begin(9600);
189+
Serial.begin(115200);
184190

185191
if (!SPIFFS.begin()) {
186192
Serial.println("Failed to mount file system");

0 commit comments

Comments
 (0)