Giter VIP home page Giter VIP logo

psychobot's Introduction

Building

Install the dependecies: runtime: libmicrohttpd, lua, curlpp, curl, sqlite3 building: cmake, check, pkgconfig

Lots of plugins will also require libraries like lua-socket

Rasbian/Debian/Ubuntu: sudo apt-get install cmake check libmicrohttpd-dev lua5.2-dev libcurlpp-dev libcurl4-openssl-dev pkg-config

Arch Linux: sudo pacman -S cmake check libmicrohttpd lua curl pkg-config; yaourt -S libcurlpp

OS/X: brew install cmake lua libmicrohttpd curlpp sqlite3 pkg-config

Then to build: release: mkdir release && cd release && cmake .. && make

debug: mkdir debug && cd debug && cmake -DCMAKE_BUILD_TYPE=Debug .. && make

Configuration

Create config.json in the same directory as the executable and add the following fields:

{
    "token"       : "YOUR TOKEN",
    "api_url"     : "https://api.telegram.org/bot",
    "webhook_url" : "YOUR SERVER URL",
    "log_level"   : "INFO",
    
    "plugins" : [ "plugin1.lua", "plugin2.lua" ]
}

Plugins

Example:

-- API v0.1 Functions:
-- 
--    send(string message)
--    reply(string message)


function run(messageText, matchStr)
    if (matchStr == "foo") then
        reply("You called foo!");
    elseif (matchStr == "bar") then
        send("You called bar!"); 
    end
end

function getInfo()
    return {
        version = "0.1",
        commandOnly = true,
        description = "This is a test description",
        usage = { foo = "does foo things",
                  bar = "does bar things"},
        commands = { "foo", "bar" },
        matches = { } -- regular expression matches; must turn off commandOnly
    };
end

psychobot's People

Contributors

fsmv avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.