No Description

cage 6e4b8e702d - added missing license attribution. 6 years ago
LICENSE 29d0c8dc7e first commit 7 years ago
LICENSES.txt 6e4b8e702d - added missing license attribution. 6 years ago bbbc623b16 () 7 years ago
cl-telegram-bot.asd b6cee53819 - fixed deconding of vectors; 6 years ago
cl-telegram-bot.lisp 43b7d41702 - fixed docstring. 6 years ago
example.lisp 91cb9156a0 () 7 years ago
package.lisp b6cee53819 - fixed deconding of vectors; 6 years ago

Telegram Bot API for Common Lisp

See the Telegram Bot API.

This library uses Drakma and CL-JSON with CLOS semantics.

This library has the following aliases: cl-telegram-bot, tl-bot, tg-bot, telegram-bot.

  • function (make-bot token) Returns a bot instance for a given token. To get a new token, see here.

  • macro (with-package package-name &rest body) Interns JSON symbols into package-name (usually, the package the bot is being used) while executing body.

  • function (access object &rest slot-list) Convenience function to access nested fields in a JSON object. Returns NIL if at least one slot is unbound. For example, to access, you can use (access update 'message 'from 'id). This operation is linear in time, so I suggest keeping it at a minimum, reusing the fields multiple times, e.g. using a let*. You can use this function from any JSON field, so (access message 'from 'id) from a previously accessed message field should be used when many nested fields share a common parent.

  • macro (decode json-object) Decode JSON object to CLOS object. Use to convert the return value of API calls when needed, e.g. (decode (send-message ...) returns an object ready to be used (by access, for example).

  • macro (find-json-symbol :symbol-name) Returns JSON-interned symbol.

  • function (get-slot obj slot) Returns slot from obj, NIL if unbound. Use with JSON CLOS object.

  • error request-error Used (currently) by get-updates on HTTP error.

  • unexported function (cl-telegram-bot::get-class-slots object) (SBCL only) Use this function to inspect JSON objects. For debugging only.

  • unexported function (cl-telegram-bot::make-request b method-name options-alist) Make direct API request using Drakma. Use for debugging only.

  • unexported function (cl-telegram-bot::trace-http) Turns on Drakma's HTTP header output. Use for debugging only.

  • function (get-updates bot &key limit timeout) Returns a vector of updates as CLOS objects.

    NOTE: The offset parameter is omitted as it is internally managed by the cl-telegram-bot:bot class.

API methods

NOTE: the keyword argument :reply-to-message-id from the official API was renamed to :reply in every function.