[add] help 完善
This commit is contained in:
parent
cecfd69bc5
commit
77da298591
38
app.js
38
app.js
@ -24,8 +24,26 @@ bot.onText(/\/start/, function (msg) {
|
||||
|
||||
bot.onText(/\/help/, function (msg) {
|
||||
const chatId = msg.chat.id;
|
||||
const resp = '才不告訴逆雷';
|
||||
bot.sendMessage(chatId, resp);
|
||||
const helpText = `
|
||||
🤖 Bot 指令清單:
|
||||
|
||||
/help - 顯示這份幫助說明
|
||||
|
||||
/roll [XdY] - 擲骰指令,代表x顆y面骰,範例:/roll 2d6,表示丟兩顆六面骰
|
||||
/draw [項目1, 項目2, 項目3] - 隨機抽籤,從提供的項目中選一個
|
||||
/everyone - 標記群組中所有有 username 的活躍使用者(僅限群組使用)
|
||||
|
||||
🎲 小提醒:/roll 的最大支援為 100 顆骰,最大面數為 1000
|
||||
📌 你的發話紀錄會自動儲存,以便 /everyone 使用
|
||||
|
||||
🛠 更多功能開發中...
|
||||
`;
|
||||
if (msg.from.id === 6218259358) {
|
||||
const resp = '才不告訴逆雷';
|
||||
bot.sendMessage(chatId, resp);
|
||||
} else {
|
||||
bot.sendMessage(chatId, helpText);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@ -52,16 +70,20 @@ bot.onText(/\/roll(?:@[\w_]+)?(?:\s+(\d*)d(\d+))?/i, function (msg, match) {
|
||||
/**
|
||||
* 抽籤系統
|
||||
*/
|
||||
bot.onText(/\/draw(?:@[\w_]+)?\s+\[([^\]]+)\]/i, (msg, match) => {
|
||||
bot.onText(/\/draw(?:@[\w_]+)?\s*\[(.+)\]/i, function (msg, match) {
|
||||
const chatId = msg.chat.id;
|
||||
const list = match[1].split(',').map(item => item.trim()).filter(Boolean);
|
||||
|
||||
if (list.length === 0) {
|
||||
if (!match[1]) {
|
||||
return bot.sendMessage(chatId, '⚠️ 請提供正確的選項格式,例如:/draw [香蕉, 你個, 芭樂]');
|
||||
}
|
||||
|
||||
const pick = list[Math.floor(Math.random() * list.length)];
|
||||
bot.sendMessage(chatId, `🎯 從 [${list.join(', ')}] 中抽出:\n👉 ${pick}`);
|
||||
const options = match[1].split(',').map(o => o.trim()).filter(o => o.length > 0);
|
||||
|
||||
if (options.length === 0) {
|
||||
return bot.sendMessage(chatId, '⚠️ 沒有有效的選項');
|
||||
}
|
||||
|
||||
const choice = options[Math.floor(Math.random() * options.length)];
|
||||
bot.sendMessage(chatId, `🎯 從 [${options.join(', ')}] 中抽出:\n👉 ${choice}`);
|
||||
});
|
||||
|
||||
bot.onText(/\/everyone/, async (msg) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user