diff --git a/404.md b/404.md index d292345..d44659a 100644 --- a/404.md +++ b/404.md @@ -3,40 +3,4 @@ permalink: /404.html --- > **Note:** You accessed a link that returned a 404, probably by clicking one of the plugin links. You're supposed to copy the link address and add it into shelter. -# [Your name here]'s shelter plugins -If you're reading this you should either change this README, -or you should run `npx degit uwu/shelter-template shelter-plugins`! - -## Getting started -You should be using [pnpm](https://pnpm.io/) with this template ideally. - -To install the dependencies and debug `hello-world` run: -```sh -pnpm i -pnpm lune dev plugins/hello-world -``` - -Ensure that Lune Dev Mode is enabled in Discord so that lune can connect to it. - -Now you can start debugging. The plugin will automatically reload after every change. - -## Installing -To then install your finished plugin in shelter you can either rely on GitHub pages and it's workflow or you can build and host them here temporarily. - -### Building locally -To build and host your plugins locally run: -```sh -pnpm lune ci -npx http-server dist/ --cors -``` -Then you can install your plugin in shelter with this URL `http://localhost:8080/hello-world`. - -### Publishing via GitHub -If you have published this repo on GitHub the plugins will be built after every commit. - -For the GitHub action to run flawlessly, make sure you have the following setting enabled: -`Repo settings > Actions > General > Workflow permissions > Read and write permissions` - -And for it to be hosted correctly you need to configure the `gh-pages` branch after its been created by the GitHub action. You can do this in `Repo settings > Pages > Branch`. - -If this worked, you will be able to install the plugin via `https://.github.io//hello-world`. +meow \ No newline at end of file diff --git a/README.md b/README.md index dc673c1..0a47d36 100644 --- a/README.md +++ b/README.md @@ -1,37 +1 @@ -# [Your name here]'s shelter plugins -If you're reading this you should either change this README, -or you should run `npx degit uwu/shelter-template shelter-plugins`! - -## Getting started -You should be using [pnpm](https://pnpm.io/) with this template ideally. - -To install the dependencies and debug `hello-world` run: -```sh -pnpm i -pnpm lune dev plugins/hello-world -``` - -Ensure that Lune Dev Mode is enabled in Discord so that lune can connect to it. - -Now you can start debugging. The plugin will automatically reload after every change. - -## Installing -To then install your finished plugin in shelter you can either rely on GitHub pages and it's workflow or you can build and host them here temporarily. - -### Building locally -To build and host your plugins locally run: -```sh -pnpm lune ci -npx http-server dist/ --cors -``` -Then you can install your plugin in shelter with this URL `http://localhost:8080/hello-world`. - -### Publishing via GitHub -If you have published this repo on GitHub the plugins will be built after every commit. - -For the GitHub action to run flawlessly, make sure you have the following setting enabled: -`Repo settings > Actions > General > Workflow permissions > Read and write permissions` - -And for it to be hosted correctly you need to configure the `gh-pages` branch after its been created by the GitHub action. You can do this in `Repo settings > Pages > Branch`. - -If this worked, you will be able to install the plugin via `https://.github.io//hello-world`. +meow \ No newline at end of file diff --git a/hello-world/plugin.json b/hello-world/plugin.json deleted file mode 100644 index c63ddf2..0000000 --- a/hello-world/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"hello-world","author":"Your name here","description":"An example shelter plugin","hash":"38b9443d1726222278f0c08f6258a9ec"} \ No newline at end of file diff --git a/hello-world/plugin.js b/remixer/plugin.js similarity index 64% rename from hello-world/plugin.js rename to remixer/plugin.js index d70b02d..87bc7e3 100644 --- a/hello-world/plugin.js +++ b/remixer/plugin.js @@ -17,22 +17,27 @@ }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - // plugins/hello-world/index.jsx - var hello_world_exports = {}; - __export(hello_world_exports, { - onLoad: () => onLoad, + // plugins/remixer/index.ts + var remixer_exports = {}; + __export(remixer_exports, { onUnload: () => onUnload }); var { - util: { - log - } + http: { intercept } } = shelter; - function onLoad() { - log("Hello, World from shelter!"); - } + var unintercept = intercept("post", /\/channels\/\d+\/messages/, async (req, send) => { + if (req.body.attachments) { + for (let i = 0; i < req.body.attachments.length; i++) { + req.body.attachments[i] = { + ...req.body.attachments[i], + is_remix: true + }; + } + } + return send(req); + }); function onUnload() { - log("Goodbye, World from shelter!"); + unintercept(); } - return __toCommonJS(hello_world_exports); + return __toCommonJS(remixer_exports); })(); diff --git a/remixer/plugin.json b/remixer/plugin.json new file mode 100644 index 0000000..63565a4 --- /dev/null +++ b/remixer/plugin.json @@ -0,0 +1 @@ +{"name":"remixer","author":"amy","description":"set all your attachments as remix","hash":"c0b349410aef346b64dbd882ad6ad3be"} \ No newline at end of file diff --git a/show raw message/plugin.js b/show raw message/plugin.js new file mode 100644 index 0000000..8dbc4de --- /dev/null +++ b/show raw message/plugin.js @@ -0,0 +1,109 @@ +(() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + + // shltr-res-ns:solid-js/web + var require_web = __commonJS({ + "shltr-res-ns:solid-js/web"(exports, module) { + module.exports = shelter.solidWeb; + } + }); + + // plugins/show raw message/index.jsx + var show_raw_message_exports = {}; + __export(show_raw_message_exports, { + onUnload: () => onUnload + }); + var import_web = __toESM(require_web(), 1); + var import_web2 = __toESM(require_web(), 1); + var import_web3 = __toESM(require_web(), 1); + var _tmpl$ = /* @__PURE__ */ (0, import_web.template)(``, 2); + var { + util: { + getFiber, + reactFiberWalker + }, + flux: { + dispatcher, + stores + }, + observeDom, + ui: { + Button, + openModal, + ModalBody, + ModalFooter, + ModalRoot, + ModalHeader, + ModalSizes + } + } = shelter; + dispatcher.subscribe("CONTEXT_MENU_OPEN", handler); + function handler(dispatch) { + const unObserve = observeDom("[id^=message-copy-link]", (elem) => { + const messageId = reactFiberWalker(getFiber(elem), "message", true).pendingProps.message.id; + elem.insertAdjacentElement("afterend", (0, import_web3.createComponent)(Button, { + size: "MEDIUM", + get onClick() { + return clicked.bind(null, getMessageObject(messageId)); + }, + children: "show raw message object" + })); + unObserve(); + }); + setTimeout(unObserve, 500); + } + function clicked(a) { + const remove = openModal((p) => (0, import_web3.createComponent)(ModalRoot, { + get size() { + return ModalSizes.SMALL; + }, + get children() { + const _el$ = _tmpl$.cloneNode(true); + _el$.style.setProperty("overflowX", "scroll"); + _el$.style.setProperty("overflowY", "scroll"); + (0, import_web2.insert)(_el$, () => JSON.stringify(a, null, 2)); + return _el$; + } + })); + dispatcher.dispatch({ + type: "CONTEXT_MENU_CLOSE" + }); + } + function getMessageObject(messageId) { + const fluxMessages = stores.MessageStore.getMessages(stores.SelectedChannelStore.getChannelId()); + return fluxMessages._map[messageId]; + } + function onUnload() { + dispatcher.unsubscribe("CONTEXT_MENU_OPEN", handler); + } + return __toCommonJS(show_raw_message_exports); +})(); diff --git a/show raw message/plugin.json b/show raw message/plugin.json new file mode 100644 index 0000000..5290321 --- /dev/null +++ b/show raw message/plugin.json @@ -0,0 +1 @@ +{"name":"show raw messages","author":"amy","description":"see the raw message object (beta, looks like shit)","hash":"7d631fc37d6d450a9c264163d020f41b"} \ No newline at end of file diff --git a/uwuifier/plugin.js b/uwuifier/plugin.js new file mode 100644 index 0000000..db4fd0c --- /dev/null +++ b/uwuifier/plugin.js @@ -0,0 +1,125 @@ +(() => { + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + + // plugins/uwuifier/index.jsx + var uwuifier_exports = {}; + __export(uwuifier_exports, { + onUnload: () => onUnload + }); + var { + http: { + intercept + }, + util: { + log + } + } = shelter; + var endings = [ + "rawr x3", + "OwO", + "UwU", + "o.O", + "-.-", + ">w<", + "(\u2445\u02D8\uA4B3\u02D8)", + "(\uA20D\u1D17\uA20D)", + "(\u02D8\u03C9\u02D8)", + "(U \u1D55 U\u2741)", + "\u03C3\u03C9\u03C3", + "\xF2\u03C9\xF3", + "(///\u02EC///\u273F)", + "(U \uFE4F U)", + "( \u0361o \u03C9 \u0361o )", + "\u0298w\u0298", + ":3", + ":3", + // important enough to have twice + ":3", + // important enough to have thrice + "XD", + "nyaa~~", + "mya", + ">_<", + "\u{1F633}", + "\u{1F97A}", + "\u{1F633}\u{1F633}\u{1F633}", + "rawr", + "^^", + "^^;;", + "(\u02C6 \uFECC \u02C6)\u2661", + "^\u2022\uFECC\u2022^", + "/(^\u2022\u03C9\u2022^)", + "(\u273Fo\u03C9o)" + ]; + var replacements = [["small", "smol"], ["cute", "kawaii"], ["fluff", "floof"], ["love", "luv"], ["stupid", "baka"], ["what", "nani"], ["meow", "nya"], ["hello", "hewwo"]]; + function selectRandomElement(arr) { + const randomIndex = Math.floor(Math.random() * arr.length); + return arr[randomIndex]; + } + var isOneCharacterString = (str) => { + return str.split("").every((char) => char === str[0]); + }; + function replaceString(inputString) { + let replaced = false; + for (const replacement of replacements) { + const regex = new RegExp(`\\b${replacement[0]}\\b`, "gi"); + if (regex.test(inputString)) { + inputString = inputString.replace(regex, replacement[1]); + replaced = true; + } + } + return replaced ? inputString : false; + } + function uwuify(message) { + const rule = /\S+|\s+/g; + const words = message.match(rule); + let answer = ""; + if (words === null) + return ""; + for (let i = 0; i < words.length; i++) { + if (isOneCharacterString(words[i]) || words[i].startsWith("https://")) { + answer += words[i]; + continue; + } + if (!replaceString(words[i])) { + answer += words[i].replace(/n(?=[aeo])/g, "ny").replace(/l|r/g, "w"); + } else + answer += replaceString(words[i]); + } + answer += " " + selectRandomElement(endings); + return answer; + } + var unintercept = intercept("post", /\/channels\/\d+\/messages/, (req, send) => { + let newContent = req?.body?.content; + log(newContent); + if (!newContent) { + return send(req); + } + if (newContent.startsWith("!u ")) { + newContent = newContent.replace("!u ", "", 1); + req.body.content = uwuify(newContent.toLowerCase()); + } + return send(req); + }); + function onUnload() { + log("Goodbye, Wowwd fwom shewtew! ^^;;"); + unintercept(); + } + return __toCommonJS(uwuifier_exports); +})(); diff --git a/uwuifier/plugin.json b/uwuifier/plugin.json new file mode 100644 index 0000000..4b032df --- /dev/null +++ b/uwuifier/plugin.json @@ -0,0 +1 @@ +{"name":"uwuifier","author":"amy","description":"become kawaii","hash":"5f7257c987cab92b755e74b24a6b56f7"} \ No newline at end of file