Skip to content

Instantly share code, notes, and snippets.

@svemat01
svemat01 / autoComplete.md
Last active January 16, 2022 00:33
Discord.JS AutoComplete Quick docs help

AutoComplete DJS v13.3.0

What is autoComplete?

"Autocomplete is basically choices but dynamic. every time the user presses a key in an autocomplete option, the bot gets an event and it can respond with what strings it wants discord to display as choices instead of having the choices be static." - Urcute#3119 on Discord

How do we use it?

For this guide, our command will be named autocomplete, this is not some built in command.

Prepare option for autocomplete

Before we can start to recieve autocomplete events on an option, we have to actually tell discord that we want it.

@svemat01
svemat01 / handlers-AutoCompleteHandler.ts
Created May 17, 2023 17:38
Typescript bot types/handlers
import { Interaction } from 'discord.js';
import { slashCommands } from './SlashHandler';
export const autoCompletes = slashCommands.filter(
(command) => command.autoComplete
); // Auto load commands from SlashHandler but only include them if they have an autocomplete function
export const handleAutoComplete = async (
interaction: Interaction

Components

Train Task (DATA)

The data for what action should be taken by the system. Exists in two different types, collection and delivery.

Collection

Contains the station name and a rough estimate of how many items are going to be picked up.

Delivery

Contains the station name and a list of items to be picked up

Example type implementation

@svemat01
svemat01 / caps_lock_hyper_key.json
Created January 20, 2025 23:35
Karabiner Elements configs
{
"description": "Caps Lock → Hyper Key (⌃⌥⇧⌘) (Caps Lock if alone)",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
"mandatory": [],
"optional": ["any"]
}
@svemat01
svemat01 / my-grief.md
Created March 27, 2025 17:52
The Great Vitest Mocking Mystery: A Tale of Pain and Redemption

The Great Vitest Mocking Mystery: A Tale of Pain and Redemption

The Problem (aka "Why Am I Even a Developer?")

Picture this: Your tests were working perfectly fine. Life was good. Then you innocently add ONE import from cloudflare:test to your setup file, and suddenly ALL YOUR MOCKS ARE LYING TO YOU. They exist, but they do nothing. They're like ghost mocks, haunting your codebase with their useless presence.

// The import that ruined everything
import { env, applyD1Migrations } from "cloudflare:test";
@svemat01
svemat01 / lnas.md
Last active June 12, 2025 21:32
Logistics Network Addressing Standard

Logistics Network Addressing Standard (LNAS) v1.0

1.0 Introduction

This document establishes the official standards for addressing and filtering packages within our world's Create mod logistics network. This is a major revision that introduces Network Zones to handle complex routing (like bridges and portals) and integrates the Nether as a unique zone.

The primary goal is to create a unified system that is:

  • Robust: Handles complex geographical layouts, including bridged continents and dimensional travel, without logical flaws.
  • Intuitive: Uses a mnemonic, letter-based mapping for continent locations.
  • Massively Scalable: Supports a vast number of continents and areas with an expanded indexing system.