This is a QuizBot to use with Slack.
npm install slack-quizbot
token: "" // Your bot tokenadmin: // List of administrators who can perform special commands. A slack admin is considered as an admin for bot.autoReconnect: true // Automatically reconnect after an error response from Slack.autoMark: true // Automatically mark each message as read after it is processed.quizLimit: 25 // Number of questionsquizStartTime: 15 // Time (in seconds) before the first questionquizNextQuestionDelay: 5 // Time (in seconds) before asking the next questionquizBasePoint: 5 // Points earned per questionbotCmds: "./src/cmds" // Configuration file (json file) of all commands of the bot. You can change it if necessary.botMessages: "./src/messages" // File (json file) describing all the boot messages on the channel. You can change it if necessary.channel: "game" // Channel used for botdatabases:questions: "./data/questions.json" // Path to the database (json file) containing the questionsscores: "./data/scores.json" // Path to the database (json file) containing scores
var Config =token: "xoxb-219955200-k9fdgdfdf565Rt05566f"admin: "U07225LMPB" "U5KJJH0MPL"quizLimit: 45channel: "quizchan"databases:questions: "/path/to/questions/questions.json"scores: "/path/to/scores/scores.json";var QuizBot = ;var quizbot = Config;quizbot;
By default the bot will use src/cmds.json module to define the commands that can be executed on the channel. This file may be replaced by your (see Configuration section) for change the name, description and scope of the command. You can also add command aliases such start and begin execute the start function.
- !enable : Enable bot
- !disable : Disable bot
- !start : Start quiz
- !stop : Stops current quiz
- !score : Displays scores (DM)
- !myscore : Displays the user's score (DM)
- !repeat : Give current question (DM)
- !help : Display help (DM)
Commands file description :
"enable": // command name on the channel"desc": "Enable bot" // Command description"fn": "enable" // Function to run"public": false // Public access or administrator only...
The bot messages are defined in the file src/messages.json. This file may be replaced with your desired (see Configuration section).
By default the questions database is loaded from the file data/questions.json whose path is relative to your bot running the file (app.js as in the example). An absolute path is recommended.
By default the scores database is loaded from the file data/scores.json whose path is relative to your bot running the file (app.js as in the example). An absolute path is recommended.
Copyright © Harouna Madi. MIT License; see LICENSE for further details.