{"id":18695772,"url":"https://github.com/shadowlp174/revolt-uploader","last_synced_at":"2025-06-27T01:32:13.919Z","repository":{"id":63788302,"uuid":"570258970","full_name":"ShadowLp174/revolt-uploader","owner":"ShadowLp174","description":"Revolt attachment uploader for nodejs","archived":false,"fork":false,"pushed_at":"2025-02-14T19:20:35.000Z","size":31,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T12:59:34.128Z","etag":null,"topics":["attachment","file","javascript","revolt","revolt-bot","revolt-chat","revoltjs","upload"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ShadowLp174.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":"2022-11-24T18:05:45.000Z","updated_at":"2025-02-14T19:20:39.000Z","dependencies_parsed_at":"2024-01-14T19:14:12.073Z","dependency_job_id":"0a09c924-c4b2-4101-8a22-6ee153cfdb15","html_url":"https://github.com/ShadowLp174/revolt-uploader","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"5da83366321f2177da402177020e1c32a32262fd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ShadowLp174/revolt-uploader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowLp174%2Frevolt-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowLp174%2Frevolt-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowLp174%2Frevolt-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowLp174%2Frevolt-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShadowLp174","download_url":"https://codeload.github.com/ShadowLp174/revolt-uploader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShadowLp174%2Frevolt-uploader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172601,"owners_count":23270056,"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":["attachment","file","javascript","revolt","revolt-bot","revolt-chat","revoltjs","upload"],"created_at":"2024-11-07T11:16:06.841Z","updated_at":"2025-06-27T01:32:13.871Z","avatar_url":"https://github.com/ShadowLp174.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Revolt Uploader\n\nRevolt.js doesn't offer the ability to upload attachments, so here is a utility package to allow easy file uploads.\n\n## Installation\n\n`npm install revolt-uploader`\n\nIt's as easy as that! :)\n\n## Usage\n\nFirst, you have to import and initialize an uploader object.\n\n```javascript\n// import the uploader library\nconst Uploader = require(\"revolt-uploader\");\n\n// you have to initialize a revolt.js client object as well.\n// Then initialize the uploader and provide it with the client\nconst uploader = new Uploader(client);\n```\n\nNow you've got your uploader. All you have to do is to login your bot client using `client.login(\"token\")`\n\nAfter that, you can upload files to revolt's servers using the `uploadFile` method.\n\n```javascript\n// you need to attach this to a message, meaning you need to have a message object\n// you can get this by listening for the `message` event on the client object but this is up to you\nclient.on(\"message\", (message) =\u003e {\n  // the upload method will return an attachment id that you can add to the message\n  Promise.allSettled([\n    uploader.uploadFile(\"path/to/file\", \"file\"),\n    uploader.uploadFile(\"path/to/another/file\", \"another-file\"),\n  ]).then(attachments =\u003e { // we're using Promise.allSettled to asynchronously upload all of them\n    attachments = attachments.map(attachment =\u003e attachment.value); // extracting the value from the promises\n    // send the attachment to the channel\n    message.channel.sendMessage({\n        content: \"Here is your file!\",\n        attachments: attachments // Note that attachments always has to be an array, even if you're only uploading one file\n    });\n    // All done!\n  });\n\n  // async/await approach:\n  message.channel.sendMessage({\n    content: \"Here is your file!\",\n    attachments: [await uploader.uploadFile(\"/path/to/another/file\", \"file-name\")]\n  });\n});\n```\n\n#### Uploading URLs\n\nYou can upload files from urls by using the `uploadUrl` method. It will stream the file from the url to autumn without saving the image on your machine.\nIt works just like a normal file upload:\n\n```javascript\nconst id = await uploader.uploadUrl(\"url\", \"fileName\");\n```\n\n### Advanced usage\n\nIf you need to upload anything else than existing files, use the `.upload(fileData, fileName)` method.\nYou can use any kind of data object for the fileData but have to specify the file name.\n\nFor example using a stream:\n\n```javascript\nconst https = require(\"https\");\n\nclient.on(\"message\", (message) =\u003e {\n  https.get(\"\u003curl\u003e\", (response) =\u003e {\n    message.channel.sendMessage({\n      content: \"Downloaded file: \",\n      attachments: [await uploader.upload(response, \"file.filetype\")]\n    });\n  });\n});\n```\n\nFurthermore, it is possible to upload your content under different tags. The default tag is `attachments`. These tags are available:\n\n- `attachments`\n- `avatars`\n- `backgrounds`\n- `icons`\n- `banners`\n- `emojis`\n\nAll of these have different configurations and limits. See [this file](https://github.com/revoltchat/autumn/blob/d5218727e56e986a4092ee635b10c3fd7c71e373/Autumn.toml#L7C2-L7C2) for the exact specifications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowlp174%2Frevolt-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshadowlp174%2Frevolt-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshadowlp174%2Frevolt-uploader/lists"}