UNPKG

@getsolara/solara.js

Version:

A lightweight and modular Discord bot framework built on discord.js v14, with truly optional feature packages.

11 lines 509 B
module.exports = { name: "$findItem", description: "Finds the first index (1-based) of an item in a list. Args: searchItem;item1;item2;...", takesBrackets: true, execute: async (context, args) => { if (args.length < 2) return "[Error: $findItem requires searchItem and at least one item]"; const searchItem = args[0]; const items = args.slice(1); const index = items.indexOf(searchItem); return (index === -1) ? "-1" : (index + 1).toString(); } };