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

comfydiscord

v1.1.2

Published

Comfiest Discord Bot Module for Coding Cafe

Downloads

28

Readme

ComfyDiscord

We built this Comfy Discord Bot Module live on Twitch for Coding Cafe!

ComfyDiscord lets you create a bot for your Discord server SUPER EASILY in just a few lines of code.

Instafluff

Like these projects? The best way to support my open-source projects is by becoming a Comfy Sponsor on GitHub!

https://github.com/sponsors/instafluff

Come and hang out with us at the Comfiest Corner on Twitch!

https://twitch.tv/instafluff

Instructions

Node

  1. Install comfydiscord
npm install comfydiscord --save
  1. Respond to !commands in your Discord
require( "dotenv" ).config();

const ComfyDiscord = require( "comfydiscord" );
ComfyDiscord.onCommand = ( channel, user, command, message, flags ) => {
  if( command == "test" ) {
    console.log( "!test was typed in chat" );
  }
}
ComfyDiscord.Init( "MyDiscordBotToken" );

Flags

Currently, the flags possible in onCommand() are:

  • bot

Reading Chat Messages

You can read chat messages by using the onChat() handler

ComfyDiscord.onChat = ( channel, user, message, flags, extra ) => {
  console.log( channel, user, message );
}

Sending Chat Messages

Sending Chat Messages can be done through ComfyDiscord.Say( channel, message ).

Securely adding your Discord token

  1. Register a Discord App, Navigate to Bot in the Settings Menu on the page, and Get a Discord Bot Token - https://discordapp.com/developers/applications/ and Invite the Bot into your server using a link with your Bot's Client ID and permission scope https://discordapp.com/oauth2/authorize?client_id=123mybotclientid123&scope=bot&permissions=133262656
  2. Install dotenv
npm install dotenv --save
  1. Create a file named .env that looks like this:
DISCORDTOKEN=[DISCORD-BOT-TOKEN HERE] # e.g. DISCORDTOKEN=Fdkjher128764Da3B
  1. Initialize with the Token
require( "dotenv" ).config();

const ComfyDiscord = require( "comfydiscord" );
ComfyDiscord.onCommand = ( channel, user, command, message, flags ) => {
  if( command == "test" ) {
    ComfyDiscord.Say( "general", "replying to !test" );
  }
}
ComfyDiscord.Init( process.env.DISCORDTOKEN );

All Supported Events

  • onCommand( channel, user, command, message, flags, extra )

    Responds to "!" commands

    • channel (string) - Name of the Discord channel.
    • user (string) - Name of the message author.
    • command (string) - Name of the command used. The "!" is removed and is lower case.
    • message (string) - The message without the command.
    • flags (MessageFlags) - Basic flags about the user.
    • extra (MessageExtras) - Extra details from the message.
  • onChat( channel, user, message, flags, extra )

    Responds to user chatting

    • channel (string) - Name of the Discord channel.
    • user (string) - Name of the message author.
    • message (string) - The message.
    • flags (MessageFlags) - Basic flags about the user.
    • extra (MessageExtras) - Extra details from the message.

Types

  • MessageFlags (object)

    Basic flags about the user.

    • bot (boolean) If the user is a bot account.
  • MessageExtras (object)

    Extra details from the message.

    • id (string) - The message ID.
    • channelId (string) - The channel ID.
    • channel (TextChannel | DMChannel | GroupDMChannel) - Discord.js Channel.
    • userId (string) - Message author's ID.
    • username (string) - Message author's username.
    • userNumber (string) - Message author's username discriminator.
    • nickname (string) - Message author's nickname within the guild.
    • displayName (string) - Nickname or username with discriminator.
    • cleanContent (string) - The message contents with all mentions replaced by the equivalent text.

Credits

Thank you too all the participants of this project!

Gilokk0, ItsLittany, Instafluff, Instafriend, ChatTranslator, BillNash, MacabreMan, MsSaltyGiggles, That_MS_Gamer, DutchGamer46, sethorizer, TastyZero, jackconceprio, Amarogine, xRolo768, simrose4u, FlavCreations, i_am_from_mars, PhysoTronic, IAmThatOneJason, twallace123, superman1990skid, LilyHazel, Stay_Hydrated_Bot, atel0s, Docpinecone, Copperbeardy, losthewar, wietlol, caLLowCreation, JMSWRNR, BungalowGlow, theArtifacts, SausageCam, crazychick2019, morepizza308, TheHungerService, rockysenpai24, BellaTriXrbsa, where_is_laughingman, LatJorr, seniorkae, ReadyPlayerEmma, smilesandtea, merkurrz, CJnxd, primal_vertex, QuiiZyy, lewdmelon, MalForTheWin, itsboek, twitch_chat_is_stupid, iMrTnT, angel0O, ripSquidd, napkats, boki996, Clarkio, drowmander, JUBAN_3, Kyoslilmonster, ElysiaGriffin, tvgBadger, DareFutari, HonestDanGames, Dragonflytru_1, imJMB, rurutu, kazuhiko0, ichibadass, DurandalCraft, codeheir, shinageeexpress, JesusAcHe