noticeUwuzu/scripts/commands/help.ts

113 lines
4.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ueuse } from "types/types";
import { readFileSync } from "fs";
import { Reply } from "./main.js";
const helpsMin = {
"info": "このBOTについての概要を返信するコマンドです。",
"help": "コマンドの概要を返信します。追記に\`/\`抜きのコマンド名を入力することでそのコマンドの詳細(フル)を返信します。",
"follow": "コマンド送信者をフォローします。",
"unfollow": "コマンド送信者をフォロー解除します。",
"weather": "天気を返信します。",
"miq": "Make it a Quoteを生成します。",
"miq permission": "あなたに対してのMake it a Quoteを生成する要求者を制限できます。",
"miq allow": "Make it a Quoteの許可制にて生成を許可します。",
"delete": "ユーズを削除します。",
"report": "運営者に不具合などを報告します。",
"legal terms": "利用規約を返信します。",
"legal privacy": "プライバシーポリシーを返信します。",
} as { [key: string]: string };
const helpsFull = {
"info": `
このBOTについての概要を返信するコマンドです。
バージョン、開発者などが確認できます。
`,
"help": `
このコマンドです。コマンドの概要を返信します。
追記に\`/\`抜きのコマンド名を入力することでそのコマンドの詳細(フル)を返信します。
`,
"follow": `
コマンドを送信したユーザーをフォローします。
既にフォローされているユーザーも使用できます。
`,
"unfollow": `
コマンドを送信したユーザーをフォロー解除します。
既にフォローされていないユーザーも使用できます。
`,
"weather": `
天気を返信します。
毎日7:00の天気を再投稿するわけではなく、
再取得して返信します。
`,
"miq": `
Make it a Quoteを生成します。
追記に\`color: true\`と入力することでカラーモードに変更可能です。
\`/delete\`コマンドを使用して削除できます。
`,
"miq permission": `
あなたに対してのMake it a Quoteを生成する要求者を制限できます。
確認するには追記なしで実行してください。
変更するには以下のいずれかを追記に入力して実行してください。
- \`me\`: 自分自身のみになります。あなたのみが生成でき、あなた以外が生成を要求すると拒否されます。
- \`everyone\`: 全体公開になります。全てのユーザーが許可なしにあなたのユーズでMake it a Quoteを生成できます。
- \`consent\`: 許可制になります。生成を要求されるとあなたにメンションが届き許可するかを選択できます。
`,
"miq allow": `
Make it a Quoteの許可制にて生成を許可します。
形式が異なる場合生成されません。
`,
"delete": `
BOTのユーズにて返信で使用すると返信先のユーズを削除します。
`,
"report": `
不具合などを運営者にメールで報告できます。
運営者によって有効化されていないと使用できません。
\`/report\`を使用してそのユーズの追記に内容を入力することで使用できます。
`,
"legal terms": `
利用規約を返信します。
`,
"legal privacy": `
プライバシーポリシーを返信します。
`,
} as { [key: string]: string };
export default async function Help(data: ueuse) {
const packageJson = JSON.parse(readFileSync("package.json", "utf-8"));
if (
data.abi === "none" ||
data.abi === ""
) {
const helpMsg =
Object.entries(helpsMin)
.map(([command, message]) =>
`\`/${command}\`${message}`
).join('\n');
const ueuse = await Reply(`
${helpMsg}
BOTの概要は\`/info\`をご利用ください。
Wikiを見る${packageJson.repository.url}/wiki
`, data.uniqid);
console.log("ヘルプ:", ueuse);
} else {
if (Object.keys(helpsFull).indexOf(data.abi) === -1) {
const ueuse = await Reply(`
不明なコマンドです。
機能を見る:${packageJson.repository.url}/wiki
`, data.uniqid);
console.log("ヘルプ(不明コマンド)", ueuse);
} else {
const ueuse = await Reply(`
${helpsFull[data.abi]}
機能を見る:${packageJson.repository.url}/wiki
`, data.uniqid);
console.log("ヘルプ:", ueuse);
}
}
}