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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vylbot-core

v2.0.3

Published

A discord client based upon discord.js

Downloads

8

Readme

VylBot Core

Discord bot client based upon Discord.js

Installation

Download the latest version from the releases page.

Copy the config template file and fill in the values.

BOT_TOKEN={TOKEN}
BOT_PREFIX=v!

FOLDERS_COMMANDS=commands
FOLDERS_EVENTS=events

COMMANDS_DISABLED=
COMMANDS_DISABLED_MESSAGE=This command is disabled.
  • BOT_TOKEN: Your bot's token, replace {TOKEN} with your bot token.
  • BOT_PREFIX: The command prefix.
  • FOLDERS_COMMANDS: The folder which contains your commands.
  • FOLDERS_EVENTS: The folder which contains your events.
  • COMMANDS_DISABLED: List of command file names that won't run, separated by commas.
  • COMMANDS_DISABLED_MESSAGE: The message which is replied to the user who tries to run a disabled command.

Make sure that you DO NOT put your .env file into VCS!

Usage

Implement the client using something like:

// bot.ts

import { CoreClient } from "vylbot-core";

const client = new CoreClient();
client.start();

Writing Commands

The code below will reply to the user with 'PONG' when they type {PREFIX}ping

// Ping.ts

import { Command, ICommandContext } from "vylbot-core";

export default class Ping extends Command {
	constructor() {
		super();
		this._roles = [ "Moderator" ];
		this._category = "General";
	}
	
	public override execute(context: ICommandContext) {
		context.message.reply('PONG');
	}
}
  • roles: An array containing what roles the user needs in order to run the command.
  • category: The category the role is part of, useful for categorising commands together in a help command.

The context parameter contains the following:

  • name: The command name
  • args: An array of arguments supplied with the command
  • message: The Discord Message object for the command message sent

Writing Events

The code below will log to the console 'Member Joined: {USERNAME}' when a member joins a server the bot is in

// Moderation.ts

import { Event } from "vylbot-core";
import { GuildMember } from "discord.js";

export class Moderation extends Event {
	public override guildMemberAdd(member: GuildMember) {
		console.log(`Member Joined: ${member.tag}`);
	}
}

The following events are supported:

  • channelCreate(channel: Channel)
  • channelDelete(channel: Channel | PartialDMChannel)
  • channelUpdate(oldChannel: Channel, newChannel: Channel)
  • guildBanAdd(guild: Guild, user: User)
  • guildBanRemove(guild: Guild, user: User)
  • guildCreate(guild: Guild)
  • guildMemberAdd(member: GuildMember)
  • guildMemberRemove(member: GuildMember | PartialGuildMember)
  • guildMemberUpdate(oldMember: GuildMember | PartialGuildMember, newMember: GuildMember)
  • message(message: Message)
  • messageDelete(message: Message | PartialMessage)
  • messageUpdate(oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage)
  • ready()

All parameters are supplied from discord.js

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

We will not merge pull requests unless all checks pass and at least one of the repo members approves it.

See CONTRIBUTING.md for more details.