This commit is contained in:
krau
2025-12-19 13:04:24 +00:00
parent 5f18cf4697
commit ca2d061555
10 changed files with 117 additions and 69 deletions

View File

@@ -2,21 +2,35 @@
Contributing
#
Before you start, please fork this repository, clone it locally, and set up your Go development environment.
Here are some guidelines and suggestions for contributing code. You don’t have to strictly follow them, but they help speed up review and merging:
Open an issue before adding new features, so we can discuss design and implementation details and avoid work that doesn’t fit the project design.
Use modern development tools, format your code before committing, and keep the style consistent.
Use Conventional Commits, and avoid vague or overly simple commit messages.
Contributing New Storage Backend
#
Fork this repository and clone it to your local machine.
Add the new storage backend type in pkg/enums/storage/storages.go and run code generation.
Define the storage backend configuration in the config/storage directory and add it to config/storage/factory.go.
Create a new package in the storage directory, implement the storage backend, and import it in storage/storage.go.
Update the documentation to include configuration details for the new storage backend.
"><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://sabot.unv.app/en/contribute/"><meta property="og:site_name" content="Save Any Bot"><meta property="og:title" content="Contributing"><meta property="og:description" content="Contributing # Contributing New Storage Backend # Fork this repository and clone it to your local machine. Add the new storage backend type in pkg/enums/storage/storages.go and run code generation. Define the storage backend configuration in the config/storage directory and add it to config/storage/factory.go. Create a new package in the storage directory, implement the storage backend, and import it in storage/storage.go. Update the documentation to include configuration details for the new storage backend."><meta property="og:locale" content="en"><meta property="og:type" content="website"><title>Contributing | Save Any Bot</title><link rel=icon href=/favicon.png><link rel=manifest href=/manifest.json><link rel=canonical href=https://sabot.unv.app/en/contribute/><link rel=alternate hreflang=zh href=https://sabot.unv.app/contribute/ title=参与开发><link rel=stylesheet href=/book.min.a22f4c7d8c2bdc5e3d6e34ba11cb59ab50ea5772594e71305bfd5a595dc78b7e.css integrity="sha256-oi9MfYwr3F49bjS6EctZq1DqV3JZTnEwW/1aWV3Hi34=" crossorigin=anonymous><link rel=alternate type=application/rss+xml href=https://sabot.unv.app/en/contribute/index.xml title="Save Any Bot"></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
Contributing New Parsers
#
You can either implement native parsers in Go (recommended), or write JavaScript-based parser plugins."><meta name=theme-color media="(prefers-color-scheme: light)" content="#ffffff"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#343a40"><meta name=color-scheme content="light dark"><meta property="og:url" content="https://sabot.unv.app/en/contribute/"><meta property="og:site_name" content="Save Any Bot"><meta property="og:title" content="Contributing"><meta property="og:description" content="Contributing # Before you start, please fork this repository, clone it locally, and set up your Go development environment.
Here are some guidelines and suggestions for contributing code. You dont have to strictly follow them, but they help speed up review and merging:
Open an issue before adding new features, so we can discuss design and implementation details and avoid work that doesnt fit the project design. Use modern development tools, format your code before committing, and keep the style consistent. Use Conventional Commits, and avoid vague or overly simple commit messages. Contributing New Storage Backend # Add the new storage backend type in pkg/enums/storage/storages.go and run code generation. Define the storage backend configuration in the config/storage directory and add it to config/storage/factory.go. Create a new package in the storage directory, implement the storage backend, and import it in storage/storage.go. Update the documentation to include configuration details for the new storage backend. Contributing New Parsers # You can either implement native parsers in Go (recommended), or write JavaScript-based parser plugins."><meta property="og:locale" content="en"><meta property="og:type" content="website"><title>Contributing | Save Any Bot</title><link rel=icon href=/favicon.png><link rel=manifest href=/manifest.json><link rel=canonical href=https://sabot.unv.app/en/contribute/><link rel=alternate hreflang=zh href=https://sabot.unv.app/contribute/ title=参与开发><link rel=stylesheet href=/book.min.a22f4c7d8c2bdc5e3d6e34ba11cb59ab50ea5772594e71305bfd5a595dc78b7e.css integrity="sha256-oi9MfYwr3F49bjS6EctZq1DqV3JZTnEwW/1aWV3Hi34=" crossorigin=anonymous><link rel=alternate type=application/rss+xml href=https://sabot.unv.app/en/contribute/index.xml title="Save Any Bot"></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/en/><img src=/logo.png alt=Logo class=book-icon><span>Save Any Bot</span></a></h2><ul class=book-languages><li><input type=checkbox id=languages class=toggle>
<label for=languages class=flex><a role=button class="flex flex-auto"><img src=/svg/translate.svg class=book-icon alt=Languages>
English</a></label><ul><li><a href=/contribute/>简体中文</a></li></ul></li></ul><ul><li><a href=https://github.com/krau/SaveAny-Bot target=_blank rel=noopener>🔗 GitHub</a></li></ul><ul><li><span>Deployment Guide</span><ul><li><a href=/en/deployment/configuration/>Configuration Guide</a><ul><li><a href=/en/deployment/configuration/storages/>Storage Configuration</a></li></ul></li><li><a href=/en/deployment/installation/>Installation and Updates</a></li></ul></li><li><a href=/en/usage/>Usage</a><ul></ul></li><li><a href=/en/help/>Frequently Asked Questions</a><ul></ul></li><li><a href=/en/contribute/ class=active>Contributing</a><ul></ul></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/svg/menu.svg class=book-icon alt=Menu></label><h3>Contributing</h3><label for=toc-control><img src=/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#contributing-new-storage-backend>Contributing New Storage Backend</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=contributing>Contributing
<a class=anchor href=#contributing>#</a></h1><h2 id=contributing-new-storage-backend>Contributing New Storage Backend
<a class=anchor href=#contributing-new-storage-backend>#</a></h2><ol><li>Fork this repository and clone it to your local machine.</li><li>Add the new storage backend type in <code>pkg/enums/storage/storages.go</code> and run code generation.</li><li>Define the storage backend configuration in the <code>config/storage</code> directory and add it to <code>config/storage/factory.go</code>.</li><li>Create a new package in the <code>storage</code> directory, implement the storage backend, and import it in <code>storage/storage.go</code>.</li><li>Update the documentation to include configuration details for the new storage backend.</li></ol></article><footer class=book-footer><div class="flex flex-wrap justify-between"><div><a class="flex align-center" href=https://github.com/krau/saveany-bot/commit/73b5f1b18e505b93277abbf3a78f889ce1034fc4 title='Last modified by krau | 2025/06/16' target=_blank rel=noopener><img src=/svg/calendar.svg class=book-icon alt>
<span>2025/06/16</span></a></div><div><a class="flex align-center" href=https://github.com/krau/saveany-bot/edit/main/docs/content/en/contribute/_index.md target=_blank rel=noopener><img src=/svg/edit.svg class=book-icon alt>
<span>Edit this page</span></a></div></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><div class=book-comments></div><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#contributing-new-storage-backend>Contributing New Storage Backend</a></li></ul></nav></div></aside></main></body></html>
English</a></label><ul><li><a href=/contribute/>简体中文</a></li></ul></li></ul><ul><li><a href=https://github.com/krau/SaveAny-Bot target=_blank rel=noopener>🔗 GitHub</a></li></ul><ul><li><span>Deployment Guide</span><ul><li><a href=/en/deployment/configuration/>Configuration Guide</a><ul><li><a href=/en/deployment/configuration/storages/>Storage Configuration</a></li></ul></li><li><a href=/en/deployment/installation/>Installation and Updates</a></li></ul></li><li><a href=/en/usage/>Usage</a><ul></ul></li><li><a href=/en/help/>Frequently Asked Questions</a><ul></ul></li><li><a href=/en/contribute/ class=active>Contributing</a><ul></ul></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/svg/menu.svg class=book-icon alt=Menu></label><h3>Contributing</h3><label for=toc-control><img src=/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#contributing-new-storage-backend>Contributing New Storage Backend</a></li><li><a href=#contributing-new-parsers>Contributing New Parsers</a></li></ul></nav></aside></header><article class="markdown book-article"><h1 id=contributing>Contributing
<a class=anchor href=#contributing>#</a></h1><p>Before you start, please fork this repository, clone it locally, and set up your Go development environment.</p><p>Here are some guidelines and suggestions for contributing code. You don&rsquo;t have to strictly follow them, but they help speed up review and merging:</p><ul><li><strong>Open an issue before adding new features</strong>, so we can discuss design and implementation details and avoid work that doesn&rsquo;t fit the project design.</li><li><strong>Use modern development tools</strong>, format your code before committing, and keep the style consistent.</li><li><strong>Use <a href=https://www.conventionalcommits.org/en/v1.0.0/>Conventional Commits</a></strong>, and avoid vague or overly simple commit messages.</li></ul><h2 id=contributing-new-storage-backend>Contributing New Storage Backend
<a class=anchor href=#contributing-new-storage-backend>#</a></h2><ol><li>Add the new storage backend type in <code>pkg/enums/storage/storages.go</code> and run code generation.</li><li>Define the storage backend configuration in the <code>config/storage</code> directory and add it to <code>config/storage/factory.go</code>.</li><li>Create a new package in the <code>storage</code> directory, implement the storage backend, and import it in <code>storage/storage.go</code>.</li><li>Update the documentation to include configuration details for the new storage backend.</li></ol><h2 id=contributing-new-parsers>Contributing New Parsers
<a class=anchor href=#contributing-new-parsers>#</a></h2><p>You can either implement native parsers in Go (recommended), or write JavaScript-based parser plugins.</p><p>If you use Go:</p><ol><li>Create a new package under the <code>parsers</code> directory and implement the parser logic.</li><li>Register the parser in the <code>init</code> function in <code>parsers/parser.go</code>.</li></ol><p>If you use JavaScript:</p><ol><li>Refer to <code>plugins/example_parser_basic.js</code> as an example.</li><li>Create a new <code>.js</code> file in the <code>plugins</code> directory and implement your parsing logic there.</li></ol><p>Note: Parsers under the <code>plugins</code> directory are not embedded into the binary by default. Users must download them manually and place them in the configured plugin directories to enable them.</p></article><footer class=book-footer><div class="flex flex-wrap justify-between"><div><a class="flex align-center" href=https://github.com/krau/saveany-bot/commit/95f7d5abb5f63536b1ff008f95689cce69ce4253 title='Last modified by krau | 2025/12/19' target=_blank rel=noopener><img src=/svg/calendar.svg class=book-icon alt>
<span>2025/12/19</span></a></div><div><a class="flex align-center" href=https://github.com/krau/saveany-bot/edit/main/docs/content/en/contribute/_index.md target=_blank rel=noopener><img src=/svg/edit.svg class=book-icon alt>
<span>Edit this page</span></a></div></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><div class=book-comments></div><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#contributing-new-storage-backend>Contributing New Storage Backend</a></li><li><a href=#contributing-new-parsers>Contributing New Parsers</a></li></ul></nav></div></aside></main></body></html>