koishi-plugin-vvquest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +6 -0
 - package/lib/index.js +55 -0
 - package/package.json +2 -1
 
    
        package/lib/index.d.ts
    ADDED
    
    
    
        package/lib/index.js
    ADDED
    
    | 
         @@ -0,0 +1,55 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            var __defProp = Object.defineProperty;
         
     | 
| 
      
 2 
     | 
    
         
            +
            var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
         
     | 
| 
      
 3 
     | 
    
         
            +
            var __getOwnPropNames = Object.getOwnPropertyNames;
         
     | 
| 
      
 4 
     | 
    
         
            +
            var __hasOwnProp = Object.prototype.hasOwnProperty;
         
     | 
| 
      
 5 
     | 
    
         
            +
            var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
         
     | 
| 
      
 6 
     | 
    
         
            +
            var __export = (target, all) => {
         
     | 
| 
      
 7 
     | 
    
         
            +
              for (var name2 in all)
         
     | 
| 
      
 8 
     | 
    
         
            +
                __defProp(target, name2, { get: all[name2], enumerable: true });
         
     | 
| 
      
 9 
     | 
    
         
            +
            };
         
     | 
| 
      
 10 
     | 
    
         
            +
            var __copyProps = (to, from, except, desc) => {
         
     | 
| 
      
 11 
     | 
    
         
            +
              if (from && typeof from === "object" || typeof from === "function") {
         
     | 
| 
      
 12 
     | 
    
         
            +
                for (let key of __getOwnPropNames(from))
         
     | 
| 
      
 13 
     | 
    
         
            +
                  if (!__hasOwnProp.call(to, key) && key !== except)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
         
     | 
| 
      
 15 
     | 
    
         
            +
              }
         
     | 
| 
      
 16 
     | 
    
         
            +
              return to;
         
     | 
| 
      
 17 
     | 
    
         
            +
            };
         
     | 
| 
      
 18 
     | 
    
         
            +
            var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            // src/index.tsx
         
     | 
| 
      
 21 
     | 
    
         
            +
            var src_exports = {};
         
     | 
| 
      
 22 
     | 
    
         
            +
            __export(src_exports, {
         
     | 
| 
      
 23 
     | 
    
         
            +
              Config: () => Config,
         
     | 
| 
      
 24 
     | 
    
         
            +
              apply: () => apply,
         
     | 
| 
      
 25 
     | 
    
         
            +
              name: () => name
         
     | 
| 
      
 26 
     | 
    
         
            +
            });
         
     | 
| 
      
 27 
     | 
    
         
            +
            module.exports = __toCommonJS(src_exports);
         
     | 
| 
      
 28 
     | 
    
         
            +
            var import_koishi = require("koishi");
         
     | 
| 
      
 29 
     | 
    
         
            +
            var import_jsx_runtime = require("@satorijs/element/jsx-runtime");
         
     | 
| 
      
 30 
     | 
    
         
            +
            var name = "vvquest";
         
     | 
| 
      
 31 
     | 
    
         
            +
            var Config = import_koishi.Schema.object({});
         
     | 
| 
      
 32 
     | 
    
         
            +
            function apply(ctx) {
         
     | 
| 
      
 33 
     | 
    
         
            +
              ctx.command("vv <name:text>", "vvquest").action(async ({ session }, name2) => {
         
     | 
| 
      
 34 
     | 
    
         
            +
                const res = await ctx.http.get("https://api.zvv.quest/search", {
         
     | 
| 
      
 35 
     | 
    
         
            +
                  params: {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    q: name2,
         
     | 
| 
      
 37 
     | 
    
         
            +
                    n: 1
         
     | 
| 
      
 38 
     | 
    
         
            +
                  }
         
     | 
| 
      
 39 
     | 
    
         
            +
                });
         
     | 
| 
      
 40 
     | 
    
         
            +
                if (res.code == 200) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                  const imgUrl = res?.data?.[0];
         
     | 
| 
      
 42 
     | 
    
         
            +
                  if (imgUrl)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: imgUrl });
         
     | 
| 
      
 44 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 45 
     | 
    
         
            +
                  ctx.logger.warn(`vv request failed: ${res}`);
         
     | 
| 
      
 46 
     | 
    
         
            +
                }
         
     | 
| 
      
 47 
     | 
    
         
            +
              });
         
     | 
| 
      
 48 
     | 
    
         
            +
            }
         
     | 
| 
      
 49 
     | 
    
         
            +
            __name(apply, "apply");
         
     | 
| 
      
 50 
     | 
    
         
            +
            // Annotate the CommonJS export names for ESM import in node:
         
     | 
| 
      
 51 
     | 
    
         
            +
            0 && (module.exports = {
         
     | 
| 
      
 52 
     | 
    
         
            +
              Config,
         
     | 
| 
      
 53 
     | 
    
         
            +
              apply,
         
     | 
| 
      
 54 
     | 
    
         
            +
              name
         
     | 
| 
      
 55 
     | 
    
         
            +
            });
         
     | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "koishi-plugin-vvquest",
         
     | 
| 
       3 
3 
     | 
    
         
             
              "description": "A vv meme search plugin via zvv.quest",
         
     | 
| 
       4 
     | 
    
         
            -
              "version": "0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              "version": "0.0.2",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "main": "lib/index.js",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "typings": "lib/index.d.ts",
         
     | 
| 
       7 
7 
     | 
    
         
             
              "files": [
         
     | 
| 
         @@ -18,6 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
                "meme"
         
     | 
| 
       19 
19 
     | 
    
         
             
              ],
         
     | 
| 
       20 
20 
     | 
    
         
             
              "peerDependencies": {
         
     | 
| 
      
 21 
     | 
    
         
            +
                "@satorijs/element": "*",
         
     | 
| 
       21 
22 
     | 
    
         
             
                "koishi": "^4.18.3"
         
     | 
| 
       22 
23 
     | 
    
         
             
              }
         
     | 
| 
       23 
24 
     | 
    
         
             
            }
         
     |