didactic-quack

0.3.1 • Public • Published

didactic-quack

Wrapper around Telegram messenger API.

NPM Stats

Installation & setup

  1. Download Telegram app and set it up.

  2. Text to @BotFather and follow instructions to create a new bot & get api_token.

    See Official docs for Bot API.

  3. Install npm package.

    $ npm i didactic-quack --save
    

Usage

In app.js:

var DQ = require('didactic-quack');
       
var dq = new DQ({
    "token": "your_telegram_bot_api_token"
});
 
setInterval(function () {
 
    dq.getUpdates(function (err, res) {
        console.log(res);
    });
 
}, 3000);
 

Run:

$ node app.js

Commands:

Command implementations are stored in Modules. All modules should be registered in modulesList.js for bot to recognise them and referenced in modules/index.js.

Default commands:

Text this commands directly to you newly created bot.

  • /time - returns current time.

  • /log <project> | <hours> | <details> - returns logged data. (Does not do more. Only parses data and returns in user-friendly way).

<project> - String

<hours> - Double

<details> - String

Changelog:

v0.3.0 - Refactored almost all. Added modules. Offset now stored in memory.

v0.2.2 - Fixed path to offset.txt.

v0.2.0 - Removed Cron & Mongoose. Code cleanup. Changed project structure.

ToDo:

  • Set up a web hook for a bot to receive new messages automatically. (Get rid of "manual" requests to the server).

License

MIT license.

Readme

Keywords

Package Sidebar

Install

npm i didactic-quack

Weekly Downloads

0

Version

0.3.1

License

MIT

Last publish

Collaborators

  • frenchbread