{"id":18230483,"url":"https://github.com/benc-uk/fractal-bot-go","last_synced_at":"2025-04-08T09:50:45.410Z","repository":{"id":75890990,"uuid":"591357359","full_name":"benc-uk/fractal-bot-go","owner":"benc-uk","description":"Fractals \u0026 Twitter bot done with Azure Functions and Go custom handlers","archived":false,"fork":false,"pushed_at":"2023-01-20T16:22:46.000Z","size":18438,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T06:46:16.867Z","etag":null,"topics":["azure-functions","custom-handler","fractals","golang"],"latest_commit_sha":null,"homepage":"https://twitter.com/fractals_bot","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benc-uk.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-01-20T15:03:45.000Z","updated_at":"2023-01-20T22:46:27.000Z","dependencies_parsed_at":"2023-07-11T23:45:58.197Z","dependency_job_id":null,"html_url":"https://github.com/benc-uk/fractal-bot-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Ffractal-bot-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Ffractal-bot-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Ffractal-bot-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benc-uk%2Ffractal-bot-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benc-uk","download_url":"https://codeload.github.com/benc-uk/fractal-bot-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247819947,"owners_count":21001394,"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":["azure-functions","custom-handler","fractals","golang"],"created_at":"2024-11-04T11:04:20.959Z","updated_at":"2025-04-08T09:50:45.405Z","avatar_url":"https://github.com/benc-uk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Fractal Bot\n\nThis is a simple example of a Azure Function using a custom handler written in Go. It generates images of Mandlebrot and Julia set fractals, and sends them to Twitter.\n\nIt leverages the modules \u0026 packages exported from another project https://github.com/benc-uk/gofract in order to generate the fractal images.\n\n\u003cimg src=\"./docs/fractal-1.png\" width=\"500px\"/\u003e\n\u003cimg src=\"./docs/fractal-2.png\" width=\"500px\"/\u003e\n\nYou can read more about [Azure Function custom handlers here](https://learn.microsoft.com/en-us/azure/azure-functions/functions-custom-handlers)\n\n![diagram](./docs/diagram.png)\n\n## Functions\n\nThe app consists of just two functions\n\n### `fractal` \n\nThis is a HTTP trigger based function, with `enableForwardingHttpRequest` set to true (see hosts.json) this means requests are passed through directly to the function. This is so the function can return the generated PNG image to the user via their browser. Note. The route mapping is `/api/fractal` which corresponds 1:1 with the URL exposed by the Azure Functions App\n\nAll parameters for the generation of the fractal are passed in via the URL query string\n\n### `tweetFractal`\n\nThis is a timer trigger based function. The Functions runtime POSTS a HTTP request to the handler. [The payload is described here](https://learn.microsoft.com/en-us/azure/azure-functions/functions-custom-handlers#request-payload) but the handler doesn't require anything from the payload so it's not read.\n\nThe handler carries out the following each time it is invoked:\n\n- Generates parameters for \"good\" random fractal\n- Renders it to a PNG image buffer\n- Uploads the image to twitter \n- Sends a tweet with the image attached\n- Send [a JSON HTTP response back](https://learn.microsoft.com/en-us/azure/azure-functions/functions-custom-handlers#response-payload) to the functions runtime, indicating success \u0026 completion\n\nThe code to interact with the Twitter API is in `pkg/twitter` and leverages the https://github.com/dghubble/oauth1 library to sign the API requests. The required app settings (like secrets, keys etc) to send tweets can be found in `local.settings.json.sample`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenc-uk%2Ffractal-bot-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenc-uk%2Ffractal-bot-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenc-uk%2Ffractal-bot-go/lists"}