npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eliware/ask

v1.1.6

Published

A concise Discord assistant ("/ask") for quick answers, web searches, and image generation — supports slash command, mention/DM fallbacks, localization, and usage tracking.

Readme

eliware.org

@eliware/ask npm versionlicensebuild status

Ask — a focused Discord application that provides quick answers, web searches, and image generation via a single /ask command or by mentioning the bot in chat. This repository contains the bot implementation, localization files, and deployment helpers (systemd / Docker). The project is based on the @eliware/discord foundations and is ready to adapt to your server.


Table of Contents

Overview

Ask is a concise assistant for Discord that supports:

  • Short answers, summaries, and rewrites
  • Quick web searches to surface sources
  • Simple image generation (via the bot's image tool)
  • Context-aware replies by including recent channel messages
  • Images are returned to Discord without database persistence

The bot is intentionally concise: the system prompt instructs responses to be succinct and to not identify as "ChatGPT" or "OpenAI".

Features

  • Single /ask command with natural language input
  • Message fallback: mention the bot, DM it, or reply to a bot message to invoke /ask
  • Automatic inclusion of recent message history (up to 100 messages) for context
  • Image generation support (returns images as attachments or URLs)
  • Locales support for multi-language replies (see locales/)
  • Ready-to-run with systemd or Docker
  • Testable with Jest

Quick Start

  1. Clone the repo and install dependencies:

    git clone https://github.com/eliware/ask.git
    cd ask
    npm install
  2. Copy and edit environment variables:

    cp .env.example .env
    # edit .env and add your Discord token, OpenAI/API keys, etc.
  3. Start locally:

    npm start
    # or
    node ask.mjs

Usage

/ask command

Use the slash command for structured usage:

  • Examples:
    • /ask explain recursion in simple terms
    • /ask summarize the last 3 messages
    • /ask draft a 3-item meeting agenda about onboarding
    • /ask generate a simple red circle on a white background --image

The handler will:

  • Defer the reply (typing indicator) while contacting the backend
  • Include recent channel history when available
  • Return text and attach generated images (files or URLs)
  • Split long replies into multiple messages when needed

Message-based usage (mention/reply/DM)

The bot also listens for messages and will create a lightweight mock interaction when:

  • The bot is mentioned in a server message
  • The message is a reply to a message previously sent by the bot
  • The bot receives a DM

Behavior:

  • Strips the mention and uses the remaining text as the prompt (falls back to "Hello!" if empty)
  • Replies in-channel (or DMs user if response is ephemeral)
  • Uses blockquote formatting per-line for message-originated replies
  • Respects Discord message length limits (chunks to 2000 characters)

Configuration

All runtime configuration is via .env. Copy .env.example to .env and provide required values:

  • DISCORD_TOKEN / DISCORD_CLIENT_ID / DISCORD_PUBLIC_KEY (Discord app credentials)
  • OPENAI_API_KEY (OpenAI API credential)
  • LOG_LEVEL, NODE_ENV, and other standard variables

See .env.example for the complete list.

Deployment

Run locally

Start with npm start or node ask.mjs. Ensure your .env is populated.

systemd service

A sample ask.service (included) facilitates running the app as a systemd service:

  1. Copy ask.service to /usr/lib/systemd/system/ask.service and adjust paths/user.

  2. Reload and start:

    sudo systemctl daemon-reload
    sudo systemctl enable ask
    sudo systemctl start ask
    sudo systemctl status ask

Docker

Build and run:

docker build -t ask .
docker run --env-file .env ask

Security

  • Never commit .env, API keys, Discord tokens, or other credentials.
  • Keep .env user-owned and protected; use .env.example only as a placeholder template.
  • Rotate credentials immediately if they are exposed.

Localization

Responses and help text are localized via JSON files under locales/. The default English help (locales/en-US.json) contains the bot's quick-help text and install link.

Add or edit locale files to localize command names, descriptions, and bot responses.

Development & Testing

  • Tests are run with Jest:

    npm test
  • Command handlers live in commands/ (e.g., commands/ask.mjs).

  • Event handlers live in events/ (e.g., events/messageCreate.mjs).

  • The ask handler expects an interaction-like object and supports both real interactions and the lightweight mock created by the messageCreate handler.

Tips:

  • The code attempts to import @eliware/discord split helpers when available for message chunking; this is optional.
  • Typing indicator is kept alive with an interval while processing message-originated requests — ensure that any custom handlers clear this interval on completion to avoid stray timers.

Support

For help or discussion, join the community:

Discordeliware.org

eliware.org on Discord

License

MIT © 2025 Eli Sterling, eliware.org

Links