{"id":29644237,"url":"https://github.com/bug-ops/vkteams-bot-clj","last_synced_at":"2025-07-22T00:31:23.434Z","repository":{"id":303684640,"uuid":"1016313765","full_name":"bug-ops/vkteams-bot-clj","owner":"bug-ops","description":"VKTeams Bot with Clojure","archived":false,"fork":false,"pushed_at":"2025-07-08T21:23:45.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T22:28:59.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bug-ops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-08T20:20:35.000Z","updated_at":"2025-07-08T21:24:22.000Z","dependencies_parsed_at":"2025-07-08T22:30:52.316Z","dependency_job_id":"8be2a6ea-f51b-4049-8238-e2315d295588","html_url":"https://github.com/bug-ops/vkteams-bot-clj","commit_stats":null,"previous_names":["bug-ops/vkteams-bot-clj"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bug-ops/vkteams-bot-clj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fvkteams-bot-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fvkteams-bot-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fvkteams-bot-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fvkteams-bot-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bug-ops","download_url":"https://codeload.github.com/bug-ops/vkteams-bot-clj/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bug-ops%2Fvkteams-bot-clj/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266404940,"owners_count":23923490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-22T00:31:04.681Z","updated_at":"2025-07-22T00:31:23.411Z","avatar_url":"https://github.com/bug-ops.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vkteams-bot-clj\nVKTeams Bot with Clojure\n\n# VK Teams Bot - Clojure\n\nA VK Teams Bot API client library for Clojure, inspired by the Rust implementation from [bug-ops/vkteams-bot](https://github.com/bug-ops/vkteams-bot).\n\n## Features\n\n- ✅ **Complete API Client**: Full VK Teams Bot API V1 support\n- ✅ **Event Handling**: Comprehensive event processing system\n- ✅ **Keyboard Support**: Inline keyboards with buttons\n- ✅ **Configuration Management**: YAML files and environment variables\n- ✅ **Error Handling**: Robust error management and logging\n- ✅ **Async Support**: Built on http-kit for async operations\n- 🔄 **Webhook Support**: (Coming soon)\n- 🔄 **Polling Support**: (Coming soon)\n\n## Installation\n\nAdd to your `project.clj` dependencies:\n\n```clojure\n[vkteams-bot \"0.1.0-SNAPSHOT\"]\n```\n\n## Quick Start\n\n### Using Environment Variables (Recommended)\n\n```bash\n# Set up environment variables\nexport VKTEAMS_BOT_API_TOKEN=\"your-bot-token\"\nexport VKTEAMS_BOT_API_URL=\"https://example.com/bot/v1\"\n```\n\n```clojure\n(ns my-bot\n  (:require [vkteams-bot.core :as bot]))\n\n;; Create a bot from environment variables\n(def my-bot (bot/create-bot-from-config))\n\n;; Send a simple message\n(bot/send-text-message my-bot \"chat-id\" \"Hello World!\")\n\n;; Send a message with keyboard\n(let [keyboard (bot/yes-no-keyboard)]\n  (bot/send-message-with-keyboard my-bot \"chat-id\" \"Do you like this bot?\" keyboard))\n```\n\n### Using Direct Token\n\n```clojure\n(ns my-bot\n  (:require [vkteams-bot.core :as bot]))\n\n;; Create a bot with token (uses default API URL)\n(def my-bot (bot/create-bot \"your-bot-token\"))\n\n;; Send a simple message\n(bot/send-text-message my-bot \"chat-id\" \"Hello World!\")\n```\n\n## Configuration\n\n### Environment Variables\n\nThe library supports configuration through environment variables:\n\n```bash\n# Required\nexport VKTEAMS_BOT_API_TOKEN=\"your-bot-token\"\n\n# Optional - API URL (defaults to VK Teams internal API)\nexport VKTEAMS_BOT_API_URL=\"https://example.com/bot/v1\"\n\n# Optional - Webhook configuration\nexport VKTEAMS_BOT_WEBHOOK_URL=\"https://example.com/webhook\"\nexport VKTEAMS_BOT_WEBHOOK_PORT=\"8080\"\nexport VKTEAMS_BOT_LOG_LEVEL=\"info\"\nexport VKTEAMS_BOT_TIMEOUT_MS=\"30000\"\n```\n\n### Configuration File (config.yaml)\n\n```yaml\n# Required\nbot-token: \"your-bot-token\"\n\n# Optional - API URL (defaults to VK Teams internal API)\napi-url: \"https://example.com/bot/v1\"\n\n# Optional - Webhook configuration\nwebhook-url: \"https://example.com/webhook\"\nwebhook-port: 8080\nlog-level: info\ntimeout-ms: 30000\n```\n\n### Programmatic Configuration\n\n```clojure\n(def config (bot/config-from-map\n              {:bot-token \"your-bot-token\"\n               :api-url \"https://example.com/bot/v1\"\n               :log-level :info}))\n```\n\n## API Reference\n\n### Bot Creation\n\n```clojure\n;; Create bot with token (uses default configuration)\n(def bot (bot/create-bot \"token\"))\n\n;; Create bot from environment variables\n(def bot (bot/create-bot-from-config))\n\n;; Create bot with configuration file\n(def config (bot/get-config \"config.yaml\"))\n(def bot (bot/create-bot (bot/bot-token config) config))\n\n;; Create bot with custom configuration\n(def config (bot/config-from-map {:bot-token \"token\"\n                                  :api-url \"https://example.com/bot/v1\"}))\n(def bot (bot/create-bot (bot/bot-token config) config))\n```\n\n### Sending Messages\n\n```clojure\n;; Send text message\n(bot/send-text-message bot \"chat-id\" \"Hello!\")\n\n;; Send with options\n(bot/send-text-message bot \"chat-id\" \"Hello!\" {:parseMode \"markdown\"})\n\n;; Send file\n(bot/send-file bot \"chat-id\" \"/path/to/file.jpg\")\n(bot/send-file bot \"chat-id\" \"/path/to/file.jpg\" {:caption \"Image description\"})\n\n;; Reply to message\n(bot/reply-to-message bot \"chat-id\" \"Reply text\" \"original-message-id\")\n\n;; Edit message\n(bot/edit-text-message bot \"chat-id\" \"message-id\" \"New text\")\n\n;; Delete message\n(bot/delete-message bot \"chat-id\" \"message-id\")\n```\n\n### Keyboards\n\n```clojure\n;; Simple Yes/No keyboard\n(def keyboard (bot/yes-no-keyboard))\n\n;; Custom keyboard\n(def keyboard (bot/create-keyboard\n                [(bot/callback-button \"Button 1\" \"data1\")\n                 (bot/callback-button \"Button 2\" \"data2\")]\n                [(bot/url-button \"Visit Site\" \"https://example.com\")]))\n\n;; Send message with keyboard\n(bot/send-message-with-keyboard bot \"chat-id\" \"Choose option:\" keyboard)\n```\n\n### Event Handling\n\n```clojure\n;; Create event handler\n(def handler (bot/create-event-handler\n               {:message (fn [msg] (println \"Message:\" (:text msg)))\n                :callback (fn [query] (println \"Callback:\" (:data query)))\n                :chat (fn [event] (println \"Chat event:\" (:type event)))}))\n\n;; Handle events\n(bot/handle-update {:bot bot :event-handler handler} raw-update)\n```\n\n### Chat Management\n\n```clojure\n;; Get chat info\n(bot/get-chat-info bot \"chat-id\")\n\n;; Get chat members\n(bot/get-chat-members bot \"chat-id\")\n\n;; Get chat administrators\n(bot/get-chat-admins bot \"chat-id\")\n\n;; Set chat title (requires admin privileges)\n(bot/set-chat-title bot \"chat-id\" \"New Chat Title\")\n\n;; Set chat description (requires admin privileges)\n(bot/set-chat-about bot \"chat-id\" \"New chat description\")\n\n;; Pin message (requires admin privileges)\n(bot/pin-message bot \"chat-id\" \"message-id\")\n\n;; Unpin message (requires admin privileges)\n(bot/unpin-message bot \"chat-id\" \"message-id\")\n```\n\n### Files and Events\n\n```clojure\n;; Get file information\n(bot/get-file-info bot \"file-id\")\n\n;; Download file\n(bot/get-file bot \"file-id\")\n(bot/get-file bot \"file-id\" {:path \"/local/path/to/save\"})\n\n;; Get events (long polling)\n(bot/get-events bot)\n(bot/get-events bot {:pollTime 30 :lastEventId 123 :limit 10})\n```\n\n### Callback Queries\n\n```clojure\n;; Answer callback query\n(bot/answer-callback bot \"query-id\" \"Response text\")\n(bot/answer-callback bot \"query-id\" \"Response text\" {:showAlert true})\n```\n\n## Examples\n\nCheck out the examples in `src/vkteams_bot/examples/`:\n\n- `basic.clj` - Basic bot functionality\n- `extended.clj` - Advanced features demonstration including files, events, and chat management\n\n## Error Handling\n\nThe library includes comprehensive error handling:\n\n```clojure\n;; Wrap operations in error handling\n(bot/with-error-handling\n  (bot/send-text-message bot \"chat-id\" \"Hello!\"))\n\n;; Check for errors\n(let [result (bot/send-text-message bot \"chat-id\" \"Hello!\")]\n  (if (bot/error? result)\n    (println \"Error:\" (bot/error-message result))\n    (println \"Success:\" result)))\n```\n\n## Development\n\n### Running Tests\n\n```bash\nlein test\n```\n\n### Building\n\n```bash\nlein uberjar\n```\n\n### Running Examples\n\n```bash\nlein run -m vkteams-bot.examples.basic\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fvkteams-bot-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbug-ops%2Fvkteams-bot-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbug-ops%2Fvkteams-bot-clj/lists"}