Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
27 changes: 27 additions & 0 deletions src/commands/joke.ts
Original file line number Diff line number Diff line change
@@ -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;