Download scripts/cmds/newcommand.eg.js from sweet2004/bot: direct link, hf CLI and curl.
- Browser
- Download file 3.42 kB
-
https://huggingface.co/spaces/sweet2004/bot/resolve/main/scripts/cmds/newcommand.eg.js
- Command line
-
hf download hf://spaces/sweet2004/bot/scripts/cmds/newcommand.eg.js
-
curl -L -o newcommand.eg.js https://huggingface.co/spaces/sweet2004/bot/resolve/main/scripts/cmds/newcommand.eg.js
3.42 kB
| /** | |
| * @Vietnamese | |
| * Trước tiên bạn cần có kiến thức về javascript như biến, hàm, vòng lặp, mảng, object, promise, async/await,... bạn có thể tìm hiểu thêm tại đây: https://developer.mozilla.org/en-US/docs/Web/JavaScript hoặc tại đây: https://www.w3schools.com/js/ | |
| * Tiếp theo là kiến thức về Nodejs như require, module.exports, ... bạn có thể tìm hiểu thêm tại đây: https://nodejs.org/en/docs/ | |
| * Và kiến thức về api không chính thức của facebook như api.sendMessage, api.changeNickname,... bạn có thể tìm hiểu thêm tại đây: https://github.com/ntkhang03/fb-chat-api/blob/master/DOCS.md | |
| * Nếu tên file kết thúc bằng `.eg.js` thì nó sẽ không được load vào bot, nếu muốn load vào bot thì đổi phần mở rộng của file thành `.js` | |
| */ | |
| /** | |
| * @English | |
| * First you need to have knowledge of javascript such as variables, functions, loops, arrays, objects, promise, async/await, ... you can learn more at here: https://developer.mozilla.org/en-US/docs/Web/JavaScript or here: https://www.w3schools.com/js/ | |
| * Next is knowledge of Nodejs such as require, module.exports, ... you can learn more at here: https://nodejs.org/en/docs/ | |
| * And knowledge of unofficial facebook api such as api.sendMessage, api.changeNickname,... you can learn more at here: https://github.com/ntkhang03/fb-chat-api/blob/master/DOCS.md | |
| * If the file name ends with `.eg.js` then it will not be loaded into the bot, if you want to load it into the bot then change the extension of the file to `.js` | |
| */ | |
| module.exports = { | |
| config: { | |
| name: "commandName", // Name of command, it must be unique to identify with other commands | |
| version: "1.0", // Version of command | |
| author: "NTKhang", // Author of command | |
| countDown: 5, // Time to wait before executing command again (seconds) | |
| role: 0, // Role of user to use this command (0: normal user, 1: admin box chat, 2: owner bot) | |
| shortDescription: { | |
| vi: "đây là mô tả ngắn của lệnh", | |
| en: "this is short description of command" | |
| }, // Short description of command | |
| longDescription: { | |
| vi: "đây là mô tả dài của lệnh", | |
| en: "this is long description of command" | |
| }, // Long description of command | |
| category: "categoryName", // Category of command | |
| guide: { | |
| vi: "đây là hướng dẫn sử dụng của lệnh", | |
| en: "this is guide of command" | |
| } // Guide of command | |
| }, | |
| langs: { | |
| vi: { | |
| hello: "xin chào", | |
| helloWithName: "xin chào, id facebook của bạn là %1" | |
| }, // Vietnamese language | |
| en: { | |
| hello: "hello world", | |
| helloWithName: "hello, your facebook id is %1" | |
| } // English language | |
| }, | |
| // onStart is a function that will be executed when the command is executed | |
| onStart: async function ({ api, args, message, event, threadsData, usersData, dashBoardData, globalData, threadModel, userModel, dashBoardModel, globalModel, role, commandName, getLang }) { | |
| // YOUR CODE HERE, use console.log() to see all properties in variables above | |
| // getLang is a function to get language of command | |
| // getLang without parameter is a function to get language of command without parameter | |
| message.reply(getLang("hello")); | |
| // getLang with parameter is a function to get language of command with parameter (delete // in line below to test) | |
| // message.reply(getLang("hello", event.senderID)); | |
| } | |
| }; |