{"id":15470483,"url":"https://github.com/seriyps/pe4kin","last_synced_at":"2025-06-17T16:33:29.010Z","repository":{"id":47093078,"uuid":"59791337","full_name":"seriyps/pe4kin","owner":"seriyps","description":"Erlang wrapper for Telegram bot API https://core.telegram.org/bots","archived":false,"fork":false,"pushed_at":"2025-06-08T14:36:38.000Z","size":89,"stargazers_count":58,"open_issues_count":1,"forks_count":30,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-08T15:28:44.693Z","etag":null,"topics":["erlang","telegram-bot"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seriyps.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}},"created_at":"2016-05-27T00:15:17.000Z","updated_at":"2025-06-08T14:36:30.000Z","dependencies_parsed_at":"2024-11-15T08:04:28.204Z","dependency_job_id":"b62b0d5e-dc52-406f-b8e4-a15e98cea90e","html_url":"https://github.com/seriyps/pe4kin","commit_stats":{"total_commits":38,"total_committers":5,"mean_commits":7.6,"dds":0.3157894736842105,"last_synced_commit":"f0cded1136ccb1c896bb7f1db9ad0b5de62cc01e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriyps%2Fpe4kin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriyps%2Fpe4kin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriyps%2Fpe4kin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriyps%2Fpe4kin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seriyps","download_url":"https://codeload.github.com/seriyps/pe4kin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seriyps%2Fpe4kin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258833930,"owners_count":22765033,"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","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":["erlang","telegram-bot"],"created_at":"2024-10-02T02:04:58.242Z","updated_at":"2025-06-17T16:33:23.999Z","avatar_url":"https://github.com/seriyps.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"pe4kin\n=====\n\nErlang Telegram bot library.\nErlang wrapper for Telegram messenger bot APIs.\n\nWith pe4kin you can receive, send, reply and forward text, as well as media\nmessages using [telegram bot API](https://core.telegram.org/bots/api).\n\nPe4kin is the name of the [multiplicational postman](https://ru.wikipedia.org/wiki/%D0%9F%D0%BE%D1%87%D1%82%D0%B0%D0%BB%D1%8C%D0%BE%D0%BD_%D0%9F%D0%B5%D1%87%D0%BA%D0%B8%D0%BD).\n\n\nExample\n-------\n\n```erlang\n% $ rebar3 compile\n% $ rebar3 shell\n\n\u003e application:ensure_all_started(pe4kin).\n\n% First of all, you need to get bot's credentials.\n% Consult telegram docs https://core.telegram.org/bots#6-botfather\n\u003e BotName = \u003c\u003c\"Pe4kin_Test_Bot\"\u003e\u003e.\n\u003e BotToken = \u003c\u003c\"186***:******\"\u003e\u003e.\n\n\n%\n% Receive messages from users\n%\n\n% Launch incoming messages receiver worker.\n% XXX: In real applications you'll want to launch pe4kin_receiver gen_server\n%      under supervisor!\n\u003e pe4kin:launch_bot(BotName, BotToken, #{receiver =\u003e true}).\n\n% Subscribe self to incoming messages\n\u003e pe4kin_receiver:subscribe(BotName, self()).\n\n% Start HTTP-polling of telegram server for incoming messages\n\u003e pe4kin_receiver:start_http_poll(BotName, #{limit=\u003e100, timeout=\u003e60}).\n\n% Wait for new messages.\n% ...here you should send \"/start\" to this bot via telegram client...\n\u003e Update = receive {pe4kin_update, BotName, Upd} -\u003e Upd end.\n\n% Guess incoming update payload type.\n\u003e message = pe4kin_types:update_type(Update).\n\n% Note `ChatId` - it uniquely identifies this particular chat and will be used\n% in replies.\n\u003e #{\u003c\u003c\"message\"\u003e\u003e := #{\u003c\u003c\"chat\"\u003e\u003e := #{\u003c\u003c\"id\"\u003e\u003e := ChatId}} = Message} = Update.\n\n% Guess message payload type\n\u003e text = pe4kin_types:message_type(Message).\n\n% Decode \"/start\" command (will raise exception if no commands in message)\n\u003e {\u003c\u003c\"/start\"\u003e\u003e, BotName, true, _} = pe4kin_types:message_command(BotName, Message).\n\n\n%\n% Send messages\n%\n\n% Check that bot configured properly\n\u003e {ok, #{\u003c\u003c\"first_name\"\u003e\u003e := _, \u003c\u003c\"id\"\u003e\u003e := _, \u003c\u003c\"username\"\u003e\u003e := _}} = pe4kin:get_me(BotName).\n\n% Send reply to previously received `Update` message (note `ChatId`)\n\u003e From = maps:get(\u003c\u003c\"first_name\"\u003e\u003e, maps:get(\u003c\u003c\"from\"\u003e\u003e, Message, #{}), \u003c\u003c\"Anonymous\"\u003e\u003e).\n\u003e HeartEmoji = pe4kin_emoji:name_to_char('heart').\n\u003e ResponseText = unicode:characters_to_binary([\u003c\u003c\"Hello, \"\u003e\u003e, From, HeartEmoji]).\n\u003e {ok, _} = pe4kin:send_message(BotName, #{chat_id =\u003e ChatId, text =\u003e ResponseText}).\n\n% Send image to the same chat\n\u003e CatImgFileName = \"funny_cat.jpg\".\n\u003e {ok, CatImgBin} = file:read_file(CatImgFileName).\n\u003e Photo = {file, CatImgFileName, \u003c\u003c\"image/jpeg\"\u003e\u003e, CatImgBin}.\n\u003e {ok, _} = pe4kin:send_photo(BotName, #{chat_id =\u003e ChatId, photo =\u003e Photo}).\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriyps%2Fpe4kin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseriyps%2Fpe4kin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseriyps%2Fpe4kin/lists"}