1.1.3 • Published 8 years ago

plugbot v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

PlugBot

Wrapper of telegram-bot-api + plugin support

Install

npm install plugbot

Setup bot

var bot = require("plugbot").PlugBot;

// set your id if you want to make bot access private
bot = new bot({
	id: <YOUR TELEGRAM ID>,
	token:  <YOUR TOKEN>,
	plugin_path : <SET IF NOT ROOT OF PROJECT>
	logging: true
});

bot.init();

Create a plugin

var plugin = new(require("plugbot").Plugin)(<NAME OF PLUGIN>);

// pass object with functions
plugin.addActions({

	action: function(content) {

		  // parse content and execute your function
		  var text = content.toUpperCase();

		  // response
		  plugin.sendText(text);
		  plugin.sendPicture("path", null);
		  plugin.sendPicture("path", "caption");

		  //or access to telegram-bot-api and get chat id
		  plugin.getApi();
		  plugin.getChatId();

	}

});

// or add single action
plugin.addAction("action", function(content) {

  // function

});

module.exports = plugin;

Call from Telegram

/name-plugin <action> <content>

License

The MIT License (MIT)

Copyright (c) 2015 Francesco Cannizzaro

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.9

8 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago