generated from sealdice/sealdice-js-ext-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Clear source file to initial state
- Loading branch information
Showing
3 changed files
with
10 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file was deleted.
Oops, something went wrong.