From 1eeeb972a97f0ff532edc730e5f97a935261fb47 Mon Sep 17 00:00:00 2001 From: IncognitoMode <84217223+IncognitoModeDev@users.noreply.github.com> Date: Sat, 20 Jan 2024 14:09:53 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bb9519..e5ff2fe 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ForestBot relies heavily on https://github.com/ForestB0T/hub ## Usage -To use ForestBot, head to the ForestBot website and reqeust him for your Minecraft Server +To use ForestBot, head to the ForestBot website and request him for your active playerbase Minecraft Server You can view your stats and learn more by visiting the ForestBot website at https://forestbot.org. From 174fdcc4ef30ec6f8808aafcf2c645ad926294c5 Mon Sep 17 00:00:00 2001 From: IncognitoMode <84217223+IncognitoModeDev@users.noreply.github.com> Date: Sat, 20 Jan 2024 14:35:56 +0800 Subject: [PATCH 2/2] Create joke.ts --- src/commands/joke.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/commands/joke.ts diff --git a/src/commands/joke.ts b/src/commands/joke.ts new file mode 100644 index 0000000..a21a91a --- /dev/null +++ b/src/commands/joke.ts @@ -0,0 +1,27 @@ +import axios from 'axios'; //requires the axios package +import { ForestBotApiClient } from 'forestbot-api'; +import type Bot from '../structure/mineflayer/Bot.js'; +import { config } from '../config.js'; + +export default { + commands: ['joke'], + description: `Use ${config.prefix}joke to get a random joke message.`, + minArgs: 0, + maxArgs: 2, + execute: async (user, args, bot, api) => { + try { + const response = await axios.get('https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit&type=single'); + + const joke = response.data.joke; + + if (joke) { + bot.bot.chat(`Random Joke: ${joke}`); + } else { + bot.bot.chat('Sorry, something went wrong. Try again later.'); + } + } catch (error) { + console.error('Error fetching joke:', error.message); + bot.bot.chat('Sorry, something went wrong. Try again later.'); + } + }, +} as MCommand;