File size: 3,417 Bytes
80ce16c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | /**
* @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));
}
}; |