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

nyrascript

v0.2.1

Published

Nyra language CLI for building and running Discord bots

Readme

Nyra

Nyra ist eine eigene DSL fuer Discord-Bots. Die Sprache bleibt bewusst direkt und lesbar: import, slash, command, func, onButton, embed, button, reply, edit, if, elif, while, for in, return, wait, purge.

Installation als CLI

npm install -g nyrascript
nyra init my-bot
cd my-bot
copy .env.example .env
nyra build bot.ny
nyra run generated/bot.nybc

Fuer die lokale Entwicklung im Nyra-Repo geht auch:

npm install
npm run build
npm link
nyra build examples/pythonish.ny

Was jetzt drin ist

  • Prefix-Commands und Slash-Commands
  • Button-Handler
  • Lokale Variablen mit let
  • Echte Zuweisungen fuer bestehende Variablen
  • Persistenter User-State ueber state.<name>
  • Booleans, and/or, !=, <=, >=, %, !
  • none als leerer Wert
  • while-Schleifen und elif
  • Eigene Funktionen mit func ... {} und return
  • Arrays mit [], Indexzugriff ueber items[0] und Schleifen mit for item in items
  • Objektliterale wie { title: "Hi", views: 3 } und Property-Zugriff ueber profile.title
  • Imports und Exporte ueber import "lib/common" und export func ...
  • Slash-Parameter wie slash profile(target: string = "", member: user optional, lucky: number = 7)
  • Funktionsaufrufe wie random, lower, upper, length, number, string, floor, ceil, round, abs, contains, startsWith, endsWith, trim, replace, substring, min, max, clamp, push, pop, join, split, range
  • Mehr Collections und Objekt-Helfer wie keys, values, has, first, last, find
  • Callback-Collections wie map(values, "upper"), filter(values, "isLong"), dazu sum, sort, reverse, unique
  • Noch mehr Python-nahe Helfer: slice, append, remove, insert, all, any, count, get
  • Mehr Built-ins: user.id, user.name, user.displayName, user.tag, channel.id, channel.name, guild.id, guild.name, command.name, interaction.customId, message.content, args, argsCount, now
  • Embeds mit title, description, color, footer, thumbnail, image

Beispiel

bot {
    prefix "!"
}

command greet(name) {
    let cleanName = user.displayName
    if contains(name, "@") {
        cleanName = name
    }
    reply "Hey " + cleanName + ", willkommen auf " + guild.name + "!"
}

slash profile {
    state.profileViews = state.profileViews + 1

    embed {
        title "Profil von " + upper(user.displayName)
        description "Ansichten: **" + state.profileViews + "**"
        color 5793266
        footer "Kanal: " + channel.name
    }
}

Neue Kontrollelemente

let attempts = 0

while attempts < 3 {
    attempts = attempts + 1
}

if attempts == 0 {
    reply "Noch kein Versuch"
} elif attempts < 3 {
    reply "Fast geschafft"
} else {
    reply "Fertig"
}

Funktionen und Arrays

func makeTags(name) {
    let tags = []
    push(tags, upper(name))
    push(tags, lower(name))
    return join(tags, " | ")
}

slash tags(target) {
    let values = split(target, " ")
    let result = []

    for item in values {
        push(result, makeTags(item))
    }

    reply join(result, "\n")
}

Objekte und Imports

export func buildProfile(name, serverName) {
    return {
        title: "Profil " + upper(name),
        footer: "Server: " + serverName
    }
}
import "lib/common"

slash profile(target: string = "", member: user optional) {
    let profile = buildProfile(target, guild.name)
    let stats = { views: state.profileViews, owner: user.displayName }

    embed {
        title profile.title
        description "Views: **" + stats.views + "**"
        footer profile.footer
    }
}

Nutzung

npm run build
npm run compile -- examples/showcase.ny
npm run run -- generated/showcase.nybc

Als global installiertes CLI:

nyra init my-bot
nyra build bot.ny
nyra run generated/bot.nybc
nyra version
nyra help

Publish auf npm

npm login
npm publish --access public

Das npm-Paket heisst nyrascript, der CLI-Befehl bleibt aber weiter nyra.

Hinweise