drift-chat-cli
Version:
Terminal-based chat client for Drift Chat - create and join temporary chat rooms from your command line
79 lines (71 loc) ⢠3.42 kB
JavaScript
const chalk = require('chalk');
class Games {
constructor() {
this.triviaQuestions = [
{ q: "What planet is known as the Red Planet?", a: "Mars" },
{ q: "What's the largest mammal in the world?", a: "Blue Whale" },
{ q: "Which programming language was created by Guido van Rossum?", a: "Python" },
{ q: "What's the capital of Japan?", a: "Tokyo" },
{ q: "How many sides does a hexagon have?", a: "6" },
{ q: "What does HTML stand for?", a: "HyperText Markup Language" },
{ q: "Which element has the chemical symbol 'O'?", a: "Oxygen" },
{ q: "What year was JavaScript created?", a: "1995" },
{ q: "What's the smallest unit of matter?", a: "Atom" },
{ q: "Which company created React?", a: "Facebook" }
];
this.fortunes = [
"š„ Your future is as bright as your faith allows it to be",
"š„ The best time to plant a tree was 20 years ago. The second best time is now",
"š„ A journey of a thousand miles begins with a single step",
"š„ You will find luck in unexpected places today",
"š„ The person who asks a question is a fool for 5 minutes. The person who doesn't ask is a fool forever",
"š„ Your code will compile on the first try today",
"š„ Debugging is twice as hard as writing code in the first place",
"š„ There are only two hard things in programming: cache invalidation and naming things",
"š„ The best error message is the one that never shows up",
"š„ Coffee + Code = ā possibilities"
];
this.asciiArt = [
` /\\_/\\ \n ( o.o ) \n > ^ < \nMeow!`,
` /| /| \n ( :v: ) \n |(_)| \nRocket!`,
` āļø āļø āļø\nāļø š āļø\n āļø āļø āļø\nHappy Cloud!`,
` š\n āā\n šāš\nāāāā\nStars!`,
`āāāāāāāāā\nā āā āā ā\nāāāāāāāāā\nBoxes!`
];
}
getRandomTrivia() {
const randomQuestion = this.triviaQuestions[Math.floor(Math.random() * this.triviaQuestions.length)];
return {
type: 'trivia',
header: chalk.magenta('š§ TRIVIA TIME!'),
content: [
chalk.white(`ā ${randomQuestion.q}`),
chalk.gray(`š” Answer: ${randomQuestion.a}`)
]
};
}
getRandomFortune() {
const randomFortune = this.fortunes[Math.floor(Math.random() * this.fortunes.length)];
return {
type: 'fortune',
header: chalk.yellow('š® YOUR FORTUNE:'),
content: [chalk.white(randomFortune)]
};
}
getRandomArt() {
const randomArt = this.asciiArt[Math.floor(Math.random() * this.asciiArt.length)];
return {
type: 'art',
header: chalk.cyan('šØ ASCII ART GALLERY:'),
content: [chalk.white(randomArt)]
};
}
getAvailableCommands() {
return [
{ command: '/trivia', description: 'Random trivia question' },
{ command: '/fortune', description: 'Fortune cookie wisdom' },
{ command: '/art', description: 'Random ASCII art' }
];
}
}
module.exports = Games;