Skip to content

Commit

Permalink
feat: Clear source file to initial state
Browse files Browse the repository at this point in the history
  • Loading branch information
MintCider committed Oct 7, 2024
1 parent 064ac0e commit c4f7911
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 42 deletions.
15 changes: 8 additions & 7 deletions header.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// ==UserScript==
// @name 模板项目
// @author 作者名
// @version 1.0.0
// @description 这是海豹的js扩展模板项目,请自行修改信息
// @timestamp 1674477074
// 2023/1/23
// @name 最终物语规则
// @author Mint Cider
// @version 0.1.0
// @description 为海豹添加最终物语规则。详细使用说明见项目主页 README。
// @timestamp 1728294492
// @license MIT
// @homepageURL https://github.com/sealdice/sealdice-js-template
// @homepageURL https://github.com/MintCider/seal-fu
// @updateUrl https://github.com/MintCider/seal-fu/releases/latest/download/seal-fu.js
// @sealVersion 1.2.0
// ==/UserScript==
32 changes: 2 additions & 30 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
import { sample } from "lodash-es";
import { nameList } from "./utils";

function main() {
// 注册扩展
let ext = seal.ext.find('test');
let ext = seal.ext.find("seal-fu");
if (!ext) {
ext = seal.ext.new('test', '木落', '1.0.0');
ext = seal.ext.new("seal-fu", "Mint Cider", "0.1.0");
seal.ext.register(ext);
}

// 编写指令
const cmdSeal = seal.ext.newCmdItemInfo();
cmdSeal.name = 'seal';
cmdSeal.help = '召唤一只海豹,可用.seal <名字> 命名';

cmdSeal.solve = (ctx, msg, cmdArgs) => {
let val = cmdArgs.getArgN(1);
switch (val) {
case 'help': {
const ret = seal.ext.newCmdExecuteResult(true);
ret.showHelp = true;
return ret;
}
default: {
// 命令为 .seal XXXX,取第一个参数为名字
if (!val) val = sample(nameList); // 无参数,随机名字
seal.replyToSender(ctx, msg, `你抓到一只海豹!取名为${val}\n它的逃跑意愿为${Math.ceil(Math.random() * 100)}`);
return seal.ext.newCmdExecuteResult(true);
}
}
}

// 注册命令
ext.cmdMap['seal'] = cmdSeal;
}

main();
5 changes: 0 additions & 5 deletions src/utils.ts

This file was deleted.

0 comments on commit c4f7911

Please sign in to comment.