Skip to content

Instantly share code, notes, and snippets.

View boly38's full-sized avatar

Vandeputte Brice boly38

View GitHub Profile
@boly38
boly38 / Listing.js
Created March 23, 2022 12:18
Mongoose expireAt example
import mongoose from 'mongoose';
const { Schema } = mongoose;
const Listing = new Schema({
"listing_id": { type: Number, index: true, unique: true },
"title": String,
"expireAt": { type: Date, expires: 10 } // <========== TTL index here
});
export { Listing };
import * as mineflayer from "mineflayer";
const username = process.env.BOT_USERNAME || 'SAMPLE[bot]';
const host = "127.0.0.1";
const port = process.env.MINECRAFT_SERVER_PORT || 25565; // /publish true adventure 25565
console.log(`chicken bot ${host}:${port}`)
const bot = mineflayer.createBot({host, port, username});
// Log errors and kick reasons:
bot.on('kicked', console.log)