• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

CasaJasmina/TelegramBot-Library: Host a Telegram Bot on your Arduino, and intera ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

CasaJasmina/TelegramBot-Library

开源软件地址(OpenSource Url):

https://github.com/CasaJasmina/TelegramBot-Library

开源编程语言(OpenSource Language):

C++ 100.0%

开源软件介绍(OpenSource Introduction):

TelegramBot Library

A project by Casa Jasmina

Introduction

This library allows you to host a Telegram Bot on your Arduino, and interact with telegram bot API.

It works on [Arduino/Genuino MKR1000] (http://www.arduino.cc/en/Main/ArduinoMKR1000), and on Arduino Zero with the WiFi shield 101.

Installing

The library can be installed from the library manager or added manually selecting the menu:

 Sketch / include Library / Add .Zip library

You also have to install the ArduinoJson library written by Benoît Blanchon. Available here.

Getting started

View the last released Telegram API documentation at: https://core.telegram.org/bots/api.

To generate your new Bot, you need an Access Token. Talk to BotFather and follow a few simple steps described here.

For full details, see "Bots: An introduction for developers".

Api Reference

TelegramBot(const char* token, Client &client);
String sendMessage(String chat_id, String my_text);
String sendMessage(String chat_id, String my_text, Keyboard keyboard, bool one_time_keyboard = true, bool resize_keyboard = true);
String postMessage(String msg);
message getUpdates();
struct message{
  const char* text;
  const char* chat_id;
  const char* sender;
  const char* date;
};

Groups implementation

When the bot is included in a group it will be, by default, in privacy mode. Which means that it will receive only messages starting with "/", the so called commands. In order to disable the privacy mode you have to chat with BotFather and use this commands:

/mybots
@yourBot
Bot setting
Group privacy
Turn off

You can also create your own list of commands using /setcommands while chatting with the BotFather. This list will appear only in the mobile view, pressing the "/" icon.

Reliability

In the long run we recommend to use a watchdog. If you are using the library Adafruit sleepy dog in its 1.1.1 (or later) version, you have also to download the Adafruit_ASFcore library.

License

You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap